1 | difference between perl and boost::regex in perl mode
|
---|
2 |
|
---|
3 |
|
---|
4 | Please consider the following code snippet:
|
---|
5 |
|
---|
6 | const boost::regex r( "(?i:hour)|H");
|
---|
7 | std::string s( "H");
|
---|
8 | boost::smatch m;
|
---|
9 | s = boost::regex_match( s, m, r) ? "YES" : "no";
|
---|
10 | // s contains "no", but perl says "YES"
|
---|
11 |
|
---|
12 | the corresponding perl one-liner
|
---|
13 | perl -E 'say "H" =~ /^(?i:hour)|H$/ ? "YES" : "no"'
|
---|
14 | writes out YES (as expected)
|
---|
15 |
|
---|
16 | This is only a short example, there is erratic behaviour as long as (?i:pattern) is involved with alternation.
|
---|
17 |
|
---|
18 | The example was compiled with mingw in windows:
|
---|
19 |
|
---|
20 | $ gcc -v
|
---|
21 | Using built-in specs.
|
---|
22 | COLLECT_GCC=...\dev52031\c\bin\gcc.exe
|
---|
23 | COLLECT_LTO_WRAPPER=.../dev52031/c/bin/../libexec/gcc/i686-w64-mingw32/4.8.3/lto-wrapper.exe
|
---|
24 | Target: i686-w64-mingw32
|
---|
25 | 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,
|
---|
26 | 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'
|
---|
27 | Thread model: posix
|
---|
28 | gcc version 4.8.3 (i686-posix-sjlj, built by strawberryperl.com project)
|
---|
29 |
|
---|
30 | The library was build with:
|
---|
31 |
|
---|
32 | set toolset=gcc
|
---|
33 | set d1=define=BOOST_THREAD_USE_LIB define=BOOST_LOG_WITHOUT_EVENT_LOG define=BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN
|
---|
34 | set l1=--without-context --without-coroutine --without-coroutine2 --without-graph --without-graph_parallel
|
---|
35 | set l2= --without-math --without-mpi --without-python --without-signals --without-wave
|
---|
36 | set f1=-a -q --prefix=%drivep%\boost toolset=gcc
|
---|
37 | set t1=--layout=tagged link=static threading=multi runtime-link=shared
|
---|
38 | set w1=cxxflags="-std=c++11 -Wno-unused-local-typedefs -Wno-unknown-pragmas"
|
---|
39 |
|
---|
40 | .\b2 %d1% %l1% %l2% %f1% %t1% %w1% stage
|
---|
41 | .\b2 %d1% %l1% %l2% %f1% %t1% %w1% install
|
---|