Boost :: regex - \ bb?

I have incorrectly commented out previous code that uses boost::regex::perl. I wondered about one particular construct before, but since the code worked (more or less), I did not want to touch it.

Now I have to touch it for technical reasons (more precisely, current versions of Boost no longer accept the design), so I have to figure out what it does - or rather, should have done.

Relevant part of the regular expression:

(?<!(\bb\s|\bb|^[a-z]\s|^[a-z]))

A piece that gives me headaches \bb. I know \b, but I could not find a mention of \bb, and searching for a literal 'b'does not make sense here. Is there \bbany special undocumented function, or should I read this typo?

+5
source share
2 answers

(\bb\s|\bb|^[a-z]\s|^[a-z])matches a bif it is not preceded by a character in another word or any lowercase letter if it is at the beginning of a line. In any case, a letter may be followed by a space character. (It can also match in uppercase letters if case-insensitive mode is set, or ^it can match the beginning of a line if multi-line mode is set.)

lookbehind, . lookbehind , lookbehind. (?<=abc|xy|12345) , (?<=(abc|xy|12345)) . , , Boost docs , lookbehind .

, , lookbehind :

(?<!\bb|^[a-z])(?<!(?:\bb|^[a-z])\s)
+3

Boost, , ++, - perl - "perl-compatible" , "b" .

, , 'b'.

, , ++, , perl, perl- . , , perl (, overload::constant), . , , , , ", " b ".

, , , Boost out- Perl , - Boost- Perl, , . , , "!!!" - , , ( !)

s/\\bb\b/(?:!!!(\\p{Alpha})|\\bb)/

- , , , .

+4

All Articles