Boost C++ Libraries: Ticket #11940: difference between perl and boost::regex in perl mode https://svn.boost.org/trac10/ticket/11940 <p> Please consider the following code snippet: </p> <p> const boost::regex r( "(?i:hour)|H"); std::string s( "H"); boost::smatch m; s = boost::regex_match( s, m, r) ? "YES" : "no"; <em> s contains "no", but perl says "YES" </em></p> <p> the corresponding perl one-liner perl -E 'say "H" =~ /<sup>(?i:hour)|H$/ ? "YES" : "no"' writes out YES (as expected) </sup></p> <p> This is only a short example, there is erratic behaviour as long as (?i:pattern) is involved with alternation. </p> <p> The example was compiled with mingw: </p> <p> $ gcc -v Using built-in specs. COLLECT_GCC=...\dev52031\c\bin\gcc.exe COLLECT_LTO_WRAPPER=.../dev52031/c/bin/../libexec/gcc/i686-w64-mingw32/4.8.3/lto-wrapper.exe Target: i686-w64-mingw32 Configured with: ../../../src/gcc-4.8.3/configure --host=i686-w64-mingw32 --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-gxx-include-dir=/mingw32/i686-w64-mingw32/include/c++ --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --enable-sjlj-exceptions --disable-isl-version-check --disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686 --with-tune=generic --with-libiconv --with-system-zlib --with-gmp=/opt/build/prerequisites/i686-w64-mingw32-static --with-mpfr=/opt/build/prerequisites/i686-w64-mingw32-static --with-mpc=/opt/build/prerequisites/i686-w64-mingw32-static --with-isl=/opt/build/prerequisites/i686-w64-mingw32-static --with-cloog=/opt/build/prerequisites/i686-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='i686-posix-sjlj, built by strawberryperl.com project' CFLAGS='-O2 -pipe -I/opt/build/i686-483-posix-sjlj-rt_v3/mingw32/opt/include -I/opt/build/prerequisites/i686-zlib-static/include -I/opt/build/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/opt/build/i686-483-posix-sjlj-rt_v3/mingw32/opt/include -I/opt/build/prerequisites/i686-zlib-static/include -I/opt/build/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/opt/build/i686-483-posix-sjlj-rt_v3/mingw32/opt/lib -L/opt/build/prerequisites/i686-zlib-static/lib -L/opt/build/prerequisites/i686-w64-mingw32-static/lib' Thread model: posix gcc version 4.8.3 (i686-posix-sjlj, built by strawberryperl.com project) </p> <p> The library was build with: </p> <p> set toolset=gcc set d1=define=BOOST_THREAD_USE_LIB define=BOOST_LOG_WITHOUT_EVENT_LOG define=BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN set l1=--without-context --without-coroutine --without-coroutine2 --without-graph --without-graph_parallel set l2= --without-math --without-mpi --without-python --without-signals --without-wave set f1=-a -q --prefix=%drivep%\boost toolset=gcc set t1=--layout=tagged link=static threading=multi runtime-link=shared set w1=cxxflags="-std=c++11 -Wno-unused-local-typedefs -Wno-unknown-pragmas" </p> <p> .\b2 %d1% %l1% %l2% %f1% %t1% %w1% stage .\b2 %d1% %l1% %l2% %f1% %t1% %w1% install </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11940 Trac 1.4.3 info@… Tue, 26 Jan 2016 07:44:43 GMT attachment set https://svn.boost.org/trac10/ticket/11940 https://svn.boost.org/trac10/ticket/11940 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">regex_error.txt</span> </li> </ul> <p> the readable text of the ticket (I'm sorry for bad format of the post) </p> Ticket John Maddock Sat, 12 Mar 2016 19:32:17 GMT <link>https://svn.boost.org/trac10/ticket/11940#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11940#comment:1</guid> <description> <p> Confirmed, investigating. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Mon, 14 Mar 2016 19:23:09 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/11940#comment:2 https://svn.boost.org/trac10/ticket/11940#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Fixed in <a class="ext-link" href="https://github.com/boostorg/regex/commit/9059bfb5c6287b0c579bfa4be5160b44c8cc2957"><span class="icon">​</span>https://github.com/boostorg/regex/commit/9059bfb5c6287b0c579bfa4be5160b44c8cc2957</a> </p> Ticket