id summary reporter owner description type status milestone component version severity resolution keywords cc 13156 Not word boundary - \b vs. NOT \B are not the same anonymous John Maddock "I am reposting this from another source. In theory, \B should match everywhere \b doesn't. In boost regex, this is not the case at the beginning nor end of string. Below is a list of test results from a few Perl-like engines. Apparently, this was fixed in Perl v5.22 (below shows v5.20). The only engines that seem to handle this correctly is PHP and ECMAScript. ------------------------------------------------ {{{ Target = ' ssssssssssssss ' Replacement = '<>' ================================================== PHP 7.03 \b = ' <>ssssssssssssss<> ' \B = '<> <> <> s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s <>' (?!\b) = '<> <> <> s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s <>' (? <> <> s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s <>' (?!\B) = ' <>ssssssssssssss<> ' (?ssssssssssssss<> ' ======================================= Perl 5.20 \b = ' <>ssssssssssssss<> ' \B = '<> <> <> s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s ' (?!\b) = '<> <> <> s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s <>' (? <> <> s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s <>' (?!\B) = ' <>ssssssssssssss<> ' (?ssssssssssssss<> ' ======================================== Boost 1.64 \b = ' <>ssssssssssssss<> ' \B = ' <> <> s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s ' (?!\b) = '<> <> <> s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s <>' (? <> <> s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s <>' (?!\B) = '<> <>ssssssssssssss<> <>' (? <>ssssssssssssss<> <>' ===================================== JavaScript \b = ' <>ssssssssssssss<> ' \B = '<> <> <> s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s <>' (?!\b) = '<> <> <> s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s <>' (?!\B) = ' <>ssssssssssssss<> ' }}} " Bugs new To Be Determined regex Boost 1.64.0 Showstopper Not Word Boundary \B