Bug: Regular Expressions [^\v]* not working as expected
-
When I use search with regular expressions, I would expect [^\v]* to match a whole line until the linebreak - but it matches the whole document. However \v works fine, as does \V - am I expecting wrong or is this a bug?
-
-
Hello Sebastian,
First of all, sorry for my late reply :-(
There a particularity of the BOOST Regex ligrary, about the regex syntax
\v:-
The regex
\vrepresents any vertical blank character, that is to say one character which belongs to the range[\n\x0B\f\r] -
The regex
[\v]represents, ONLY, the vertical tabulation character, of Unicode code\x0B
So, when you write
[^\v], it matches any single character, which is different from the\x0b( VT character )Thus, your regex
[^\v]*represents any set, even empty, of characters, different from the Vertical Tabulation character, included any End Of Line character (\r,\nor\r\n)In other words, if your current file does NOT contain any
\x0bcharacter, your regex[^\v]*matches, absolutely, all the characters of the file. Quite logical !Best Regards,
guy038
P.S. :
The regex
\V( Uppercase v ) is equivalent to the range[^\n\x0B\f\r], that is to say any single character, different from a Vertical Tabulation, from a Form Feed character and from an EOL character.Again, if your file does NOT contain any
\x0band/or\x0ccharacter(s), the regex\V+matches successively, each whole line, without its line break ! -
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login