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
\v
represents 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
,\n
or\r\n
)In other words, if your current file does NOT contain any
\x0b
character, 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
\x0b
and/or\x0c
character(s), the regex\V+
matches successively, each whole line, without its line break ! -