public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/102480] New: std::regex fails to match ^ when match_prev_avail is used
@ 2021-09-24 23:34 redi at gcc dot gnu.org
  2021-09-24 23:34 ` [Bug libstdc++/102480] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2021-09-24 23:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102480
           Summary: std::regex fails to match ^ when match_prev_avail is
                    used
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
            Blocks: 102445
  Target Milestone: ---

#include <regex>
#include <cassert>

int main() {
  char str[] = "\na";
  std::regex re("^a");
  assert(std::regex_match(str + 1, str + 2, re));
  using std::regex_constants::match_prev_avail;
  assert(std::regex_match(str + 1, str + 2, re, match_prev_avail));
}

Both assertions should pass.

For the first match, the regex matches at the beginning of the input.

For the second match, the regex should also match because the previous
character is a line terminator.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102445
[Bug 102445] [meta-bug] std::regex issues

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

end of thread, other threads:[~2022-07-07 23:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-24 23:34 [Bug libstdc++/102480] New: std::regex fails to match ^ when match_prev_avail is used redi at gcc dot gnu.org
2021-09-24 23:34 ` [Bug libstdc++/102480] " redi at gcc dot gnu.org
2021-09-27 11:45 ` redi at gcc dot gnu.org
2021-09-29 12:49 ` cvs-commit at gcc dot gnu.org
2021-09-29 15:47 ` redi at gcc dot gnu.org
2022-07-07 23:32 ` cvs-commit at gcc dot gnu.org
2022-07-07 23:36 ` 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).