Skip to content

Regex should advance bumpalong position for partially-matched starting loop minimums #84149

Open
@stephentoub

Description

@stephentoub

Consider an expression like \w{10,}42. That will search for at least 10 word characters followed by the number 42. If the \w{10,} successfully matches at least 10 characters, then if matching the 42 fails, we'll still successfully bump the bumpalong position so that the next time we start the matching process, we don't have to match the same \w characters again. However, if we don't successfully match the minimum, we're not incrementing that bumpalong position, which means for an input like "abcdefghi..." where there are only 9 word characters, we'll try to match at 'a' through 'i', determine we haven't met the minimum, return to the scan loop, bump to 'b' and match through 'i', determine we haven't met the minimum, etc., repeating all of that work even though we know there's no chance we'll meet the minimum if we didn't meet it to start.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions