0

I'm looking at a longer ICU regular expression that contains:

[\\-\\s]

The limits of my understanding is the brackets and the "-", so I'm thinking it means:

match a character, in the range of literal-backslash to any-whitespace...

But how do you do that? Shouldn't a range be two distinct points in the character space, like the classic "[a-z]" ?

If it helps:

The "\s" is "Match a white space character. White space is defined as [\t\n\f\r\p{Z}].

Regular Expressions - ICU User Guide

benc
  • 1,171
  • 5
  • 28
  • 34
  • 1
    It is not a range, it only matches a `-` or any whitespace. Someone just overescaped the pattern, `"[-\\s]"` is the same. Could you please show full relevant code? Is it Swift? – Wiktor Stribiżew Jul 07 '17 at 20:03
  • Its in Swift, but I can't share the full expression. :( I did peel it apart isolate it. Isn't "\\" valid in a set as the backslash-escaped? Thats what really confused me. – benc Jul 07 '17 at 20:18
  • I added 2 close reasons explaining what the backslashes and regex denote. – Wiktor Stribiżew Jul 07 '17 at 20:26

0 Answers0