Subject: [Boost-bugs] [Boost C++ Libraries] #13156: Not word boundary - \b vs. NOT \B are not the same
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-08-10 01:36:31
#13156: Not word boundary - \b vs. NOT \B are not the same
----------------------------------+--------------------------
Reporter: anonymous | Owner: John Maddock
Type: Bugs | Status: new
Milestone: To Be Determined | Component: regex
Version: Boost 1.64.0 | Severity: Showstopper
Keywords: Not Word Boundary \B |
----------------------------------+--------------------------
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 <>'
(?<!\b) = '<> <> <> s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s <>'
(?!\B) = ' <>ssssssssssssss<> '
(?<!\B) = ' <>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 <>'
(?<!\b) = '<> <> <> s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s <>'
(?!\B) = ' <>ssssssssssssss<> '
(?<!\B) = ' <>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 <>'
(?<!\b) = '<> <> <> s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>s <>'
(?!\B) = '<> <>ssssssssssssss<> <>'
(?<!\B) = '<> <>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<> '
}}}
-- Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13156> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-08-10 01:39:50 UTC