This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/61227] [C++11] Regex does not work


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]