Skip to content

basic_regex::__search error with "$" pattern #64475

Open
@alkino

Description

@alkino

Hello,

If we use a pattern like $ or something more complex as *$ but that does not match the string,
__search return false as not found because we don't try the empty string.

The problem is the for loop:

for (++__first; __first != __last; ++__first)

An example, is trying to match $ against hello.
We will successively try:

  • hello (before the loop)
  • ello
  • llo
  • lo
  • o

And nothing else, and so this is not a match.

It seems that having a last run with __match_at_start(__last, __last, __m, __flags, false) (only if match_not_null is not set) fix the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.regexIssues related to regex

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions