Modify

#11940 closed Bugs (fixed)

difference between perl and boost::regex in perl mode

Reported by: info@… Owned by: John Maddock
Milestone: To Be Determined Component: regex
Version: Boost 1.59.0 Severity: Problem
Keywords: Cc:

Description

Please consider the following code snippet:

const boost::regex r( "(?i:hour)|H"); std::string s( "H"); boost::smatch m; s = boost::regex_match( s, m, r) ? "YES" : "no"; s contains "no", but perl says "YES"

the corresponding perl one-liner perl -E 'say "H" =~ /(?i:hour)|H$/ ? "YES" : "no"' writes out YES (as expected)

This is only a short example, there is erratic behaviour as long as (?i:pattern) is involved with alternation.

The example was compiled with mingw:

$ 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)

The library was build with:

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"

.\b2 %d1% %l1% %l2% %f1% %t1% %w1% stage .\b2 %d1% %l1% %l2% %f1% %t1% %w1% install

Attachments (1)

regex_error.txt (3.2 KB) - added by info@… 20 months ago.
the readable text of the ticket (I'm sorry for bad format of the post)

Download all attachments as: .zip

Change History (3)

Changed 20 months ago by info@…

Attachment: regex_error.txt added

the readable text of the ticket (I'm sorry for bad format of the post)

comment:1 Changed 19 months ago by John Maddock

Confirmed, investigating.

comment:2 Changed 19 months ago by John Maddock

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain John Maddock.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.