0

My Problem

I have this problem i don't really understand: i wanted to create a std::basic_regex matching n+ '[' like this:

[...]
std::basic_regex("[+");
[...]

but well '[' has not be escaped, so i get this exception (which is logic):

terminate called after throwing an instance of 'std::regex_error'
  what():  regex_error

Then I tried to repair my mistake by escaping the '[' like this:

[...]
std::basic_regex("\\[+");
[...]

And there I don't know why but i still got the throwing exception:

terminate called after throwing an instance of 'std::regex_error'
  what():  regex_error

So?

Anyone has this same error? or am i doing something wrong?

Edit:

Forgot to put my g++ version:

g++ (Ubuntu 4.8.1-2ubuntu1~12.04) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CollioTV
  • 684
  • 3
  • 13

0 Answers0