Why does this find no matches in g++ (Debian 4.6.3-1) 4.6.3 or clang version 3.2 (trunk 159457)
#include <iostream>
#include <string>
#include <regex>
using namespace std;
int main()
{
string line("test");
regex pattern("test",regex_constants::grep);
smatch result;
bool ret(false);
ret = regex_search(line,result,pattern);
cout << boolalpha << ret << endl;
cout << result.size() << endl;
return 0 ;
}
output
false
0
Because <regex>
is not yet implemented in libstdc++, as documented here (§28).
For now, use Boost.Xpressive or Boost.Regex instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With