public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/68032] New: std-c++-14: Regex fails to match
@ 2015-10-20 15:09 georg@schorsch-tech.de
  2015-10-20 16:59 ` [Bug libstdc++/68032] " timshen at gcc dot gnu.org
  2015-10-20 23:11 ` georg@schorsch-tech.de
  0 siblings, 2 replies; 3+ messages in thread
From: georg@schorsch-tech.de @ 2015-10-20 15:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 68032
           Summary: std-c++-14: Regex fails to match
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: georg@schorsch-tech.de
  Target Milestone: ---

I try to parse some data files and check the data with regex. During the parse
it fails on some lines. I reduced the code to the following.

<code>
#include <regex>
#include <iostream>
#include <string>
int main(int argc, char** argv)
{
        std::string data = " data(C96) = { 96, 1000, 15000, 6400, 6470, 0, 0,
7490, 8000, 1000, 1, 10, 0 };";
        auto ex0 = std::regex("data\\(([a-zA-Z0-9_-]+)\\) ?= ?\\{ ?([0-9+]),
?([0-9]+), ?([0-9]+), ?([0-9]+), ?([0-9]+), ?([0-9]+), ?([0-9]+), ?([0-9]+),
?([0-9]+), ?([0-9]+), ?([0-9]+), ?([0-9]+), ?([0-9]+) ?\\};");
        std::smatch what;

        if (std::regex_search(data, what, ex0))
        {
                std::cout << "Matched" << std::endl;
        }
        else
        {
                std::cout << "FAIL" << std::endl;
        }
}
</code>

Compile it with
g++ --std=c++14 main.cpp -o test

run it:
./test

Result:
FAIL:

Expected:
Matched

g++ --version
g++ (Gentoo 5.2.0 p1.2, pie-0.6.4) 5.2.0
Copyright (C) 2015 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.


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

* [Bug libstdc++/68032] std-c++-14: Regex fails to match
  2015-10-20 15:09 [Bug c++/68032] New: std-c++-14: Regex fails to match georg@schorsch-tech.de
@ 2015-10-20 16:59 ` timshen at gcc dot gnu.org
  2015-10-20 23:11 ` georg@schorsch-tech.de
  1 sibling, 0 replies; 3+ messages in thread
From: timshen at gcc dot gnu.org @ 2015-10-20 16:59 UTC (permalink / raw)
  To: gcc-bugs

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

Tim Shen <timshen at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timshen at gcc dot gnu.org

--- Comment #1 from Tim Shen <timshen at gcc dot gnu.org> ---
I think you mean:
"data\\(([a-zA-Z0-9_-]+)\\) ?= ?\\{ ?([0-9]+), ?([0-9]+), ?([0-9]+), ?([0-9]+),
?([0-9]+), ?([0-9]+), ?([0-9]+), ?([0-9]+), ?([0-9]+), ?([0-9]+), ?([0-9]+),
?([0-9]+), ?([0-9]+) ?\\};"

instead of:
"data\\(([a-zA-Z0-9_-]+)\\) ?= ?\\{ ?([0-9+]), ?([0-9]+), ?([0-9]+), ?([0-9]+),
?([0-9]+), ?([0-9]+), ?([0-9]+), ?([0-9]+), ?([0-9]+), ?([0-9]+), ?([0-9]+),
?([0-9]+), ?([0-9]+) ?\\};"


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

* [Bug libstdc++/68032] std-c++-14: Regex fails to match
  2015-10-20 15:09 [Bug c++/68032] New: std-c++-14: Regex fails to match georg@schorsch-tech.de
  2015-10-20 16:59 ` [Bug libstdc++/68032] " timshen at gcc dot gnu.org
@ 2015-10-20 23:11 ` georg@schorsch-tech.de
  1 sibling, 0 replies; 3+ messages in thread
From: georg@schorsch-tech.de @ 2015-10-20 23:11 UTC (permalink / raw)
  To: gcc-bugs

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

georg@schorsch-tech.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from georg@schorsch-tech.de ---
Hello Tim,
yes, you are right! Now it works as expected. In fact i'm happy that it was
such an error.


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

end of thread, other threads:[~2015-10-20 23:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-20 15:09 [Bug c++/68032] New: std-c++-14: Regex fails to match georg@schorsch-tech.de
2015-10-20 16:59 ` [Bug libstdc++/68032] " timshen at gcc dot gnu.org
2015-10-20 23:11 ` georg@schorsch-tech.de

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).