Skip to content

Is this the correct way to use byte::Regex? #1246

Answered by BurntSushi
kirs112 asked this question in Q&A
Discussion options

You must be logged in to vote

You almost got it. You just need to disable Unicode mode in your pattern. e.g., (?-u)^blahblah. Otherwise, things like \xFF are interpreted as the "the UTF-8 encoding of U+00FF," which for non-ASCII codepoints, is different than the raw byte \xFF. By disabling Unicode mode, \xFF is interpreted as matching the raw byte \xFF.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants