public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/61227] [C++11] Regex does not work
       [not found] <bug-61227-4@http.gcc.gnu.org/bugzilla/>
@ 2014-05-19 12:23 ` redi at gcc dot gnu.org
  2014-05-19 12:38 ` schwab@linux-m68k.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-05-19 12:23 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/61227] [C++11] Regex does not work
       [not found] <bug-61227-4@http.gcc.gnu.org/bugzilla/>
  2014-05-19 12:23 ` [Bug libstdc++/61227] [C++11] Regex does not work redi at gcc dot gnu.org
@ 2014-05-19 12:38 ` schwab@linux-m68k.org
  2014-05-19 13:40 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: schwab@linux-m68k.org @ 2014-05-19 12:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61227

--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> ---
The C++ standard refers to ECMA-262 which defines [\w] as Perl does.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/61227] [C++11] Regex does not work
       [not found] <bug-61227-4@http.gcc.gnu.org/bugzilla/>
  2014-05-19 12:23 ` [Bug libstdc++/61227] [C++11] Regex does not work redi at gcc dot gnu.org
  2014-05-19 12:38 ` schwab@linux-m68k.org
@ 2014-05-19 13:40 ` redi at gcc dot gnu.org
  2014-05-19 14:35 ` fatony at fatony dot net
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-05-19 13:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61227

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
So it does, thanks, Andreas. I read C++11 [re.grammar]/7 as saying those
classes are part of the changes to the ECMAScript spec.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/61227] [C++11] Regex does not work
       [not found] <bug-61227-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2014-05-19 13:40 ` redi at gcc dot gnu.org
@ 2014-05-19 14:35 ` fatony at fatony dot net
  2014-05-20  4:32 ` [Bug libstdc++/61227] [C++11] Regex [\w] " timshen at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: fatony at fatony dot net @ 2014-05-19 14:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61227

--- Comment #4 from FaTony <fatony at fatony dot net> ---
The first regex is used to find illegal characters in symbol name in my
project. The last regex is used to tokenize command line arguments. Those
regexes work in Visual Studio 2012/2013 and clang with libc++.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/61227] [C++11] Regex [\w] does not work
       [not found] <bug-61227-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2014-05-19 14:35 ` fatony at fatony dot net
@ 2014-05-20  4:32 ` timshen at gcc dot gnu.org
  2014-06-03 14:56 ` fatony at fatony dot net
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: timshen at gcc dot gnu.org @ 2014-05-20  4:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61227

--- Comment #5 from Tim Shen <timshen at gcc dot gnu.org> ---
Author: timshen
Date: Tue May 20 04:31:54 2014
New Revision: 210630

URL: http://gcc.gnu.org/viewcvs?rev=210630&root=gcc&view=rev
Log:
2014-05-20  Tim Shen  <timshen91@gmail.com>

    PR libstdc++/61227
    * include/bits/regex_compiler.h
    (_BracketMatcher<>::_M_add_character_class): Add negative character
    class support.
    * include/bits/regex_compiler.tcc (_BracketMatcher<>::_M_apply):
    Likewise.
    * testsuite/28_regex/algorithms/regex_match/ecma/char/quoted_char.cc:
    Add more testcases.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/regex_compiler.h
    trunk/libstdc++-v3/include/bits/regex_compiler.tcc
   
trunk/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/quoted_char.cc


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/61227] [C++11] Regex [\w] does not work
       [not found] <bug-61227-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2014-05-20  4:32 ` [Bug libstdc++/61227] [C++11] Regex [\w] " timshen at gcc dot gnu.org
@ 2014-06-03 14:56 ` fatony at fatony dot net
  2014-06-03 17:27 ` redi at gcc dot gnu.org
  2014-06-03 17:28 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: fatony at fatony dot net @ 2014-06-03 14:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61227

--- Comment #6 from FaTony <fatony at fatony dot net> ---
Hi. I'm using Debain Testing and today according to changelog:
* Update to SVN 20140527 (r210956) from the gcc-4_9-branch.

The bug still persists.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/61227] [C++11] Regex [\w] does not work
       [not found] <bug-61227-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2014-06-03 14:56 ` fatony at fatony dot net
@ 2014-06-03 17:27 ` redi at gcc dot gnu.org
  2014-06-03 17:28 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-06-03 17:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61227

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Tue Jun  3 17:26:24 2014
New Revision: 211192

URL: http://gcc.gnu.org/viewcvs?rev=211192&root=gcc&view=rev
Log:
Backport from mainline
2014-05-20  Tim Shen  <timshen91@gmail.com>

    PR libstdc++/61227
    * include/bits/regex_compiler.h
    (_BracketMatcher<>::_M_add_character_class): Add negative character
    class support.
    * include/bits/regex_compiler.tcc (_BracketMatcher<>::_M_apply):
    Likewise.
    * testsuite/28_regex/algorithms/regex_match/ecma/char/quoted_char.cc:
    Add more testcases.

Modified:
    branches/gcc-4_9-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_9-branch/libstdc++-v3/include/bits/regex_compiler.h
    branches/gcc-4_9-branch/libstdc++-v3/include/bits/regex_compiler.tcc
   
branches/gcc-4_9-branch/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/quoted_char.cc


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/61227] [C++11] Regex [\w] does not work
       [not found] <bug-61227-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2014-06-03 17:27 ` redi at gcc dot gnu.org
@ 2014-06-03 17:28 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-06-03 17:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61227

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.9.1

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Now it's fixed on the 4.9 branch.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-06-03 17:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-61227-4@http.gcc.gnu.org/bugzilla/>
2014-05-19 12:23 ` [Bug libstdc++/61227] [C++11] Regex does not work redi at gcc dot gnu.org
2014-05-19 12:38 ` schwab@linux-m68k.org
2014-05-19 13:40 ` redi at gcc dot gnu.org
2014-05-19 14:35 ` fatony at fatony dot net
2014-05-20  4:32 ` [Bug libstdc++/61227] [C++11] Regex [\w] " timshen at gcc dot gnu.org
2014-06-03 14:56 ` fatony at fatony dot net
2014-06-03 17:27 ` redi at gcc dot gnu.org
2014-06-03 17:28 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).