Matching non-backslash characters #766
-
Hi Everyone, but
I don't understand how UTF8 is involved since the methods for I've attached a sample program. Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Turns out I had unicode disabled (from a different project I was working on) |
Beta Was this translation helpful? Give feedback.
-
Yes. If you try compiling
Let's take a look at how you're building the regex: let r1 = RegexBuilder::new(REGEX_TEST)
.unicode(false)
.build()
.expect("Failed to compile regular expression"); When If disabling Unicode wasn't intentional, then, well, don't disable it and your regex will work. IIRC, Windows paths are Unicode aware. And if they're in a If disabling Unicode was intentional, then these errors are correct and are preventing you from making mistakes. In particular, since you are searching a If you do want to be able to match arbitrary bytes like this, then the correct answer is to use the |
Beta Was this translation helpful? Give feedback.
Yes. If you try compiling
(?i)(^\w+:\\){1}Users\\[\\]+?\\AppData\\Local\\.*
without any other changes, then you'll get this error:Let's take a look at how you're building the regex:
When
unicode
is disabled (which you could also do with(?-u)
or(?i-u)
in your case), then everything in the regex that was Unicode aware becomes a simple operation on bytes. So in…