This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/61227] [C++11] Regex does not work
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 19 May 2014 12:23:41 +0000
- Subject: [Bug libstdc++/61227] [C++11] Regex does not work
- Auto-submitted: auto-generated
- References: <bug-61227-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61227
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-05-19
CC| |timshen at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Only your first and last regexes give an error, it would be helpful if you said
what you expect them to do.
The sequence \w is intepreted as [_[:alnum:]] but is rejected inside a bracket
expression.
Reduced:
#include <regex>
int main()
{
std::regex{ R"([\w])" };
}
For this to match a string such as "w" or "\\" it should be R"([\\w])"
To use the special \w class you can use [_[:alnum:]] as a workaround.
Tim, could you take a look at this please?
I don't think the C++ standard is clear, but Perl does interpret [\w] as
equivalent to just \w so I think we should do the same.