M
Melzzzzz
This is starting to sound rather unlikely ... care to cite any
references?
The web page I found at gcc.org which claimed "no support at all for
std::regex" was obviously wrong. And now that I bothered to check my
own system, I see that even libstdc++ 4.6 is shock full of regex
implementation.
/Jorgen
bmaxa@maxa:~/examples$ cat regex.cpp
//Example 1
#include <iostream>
#include <regex>
#include <string>
using namespace std;
int main()
{
string input;
regex integer("(\\+|-)?[[:digit:]]+");
//As long as the input is correct ask for another number
while(true)
{
cout<<"Give me an integer!"<<endl;
cin>>input;
//Exit when the user inputs q
if(input=="q")
break;
if(regex_match(input,integer))
cout<<"integer"<<endl;
else
{
cout<<"Invalid input"<<endl;
}
}
}
bmaxa@maxa:~/examples$ g++ -std=c++11 regex.cpp -o regex
bmaxa@maxa:~/examples$ ./regex
terminate called after throwing an instance of 'std::regex_error'
what(): regex_error
Aborted (core dumped)
bmaxa@maxa:~/examples$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.7.3-1ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --enable-objc-gc --with-cloog --enable-cloog-backend=ppl --disable-cloog-version-check --disable-ppl-version-check --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1)
Does not work...