Skip to content

RegExp.firstMatch should have a start argument #26815

Open
@Hixie

Description

@Hixie

I want to try a bunch of patterns from one start index, then try them all again from the end position of the first match, if there was a match, until I get to the point where there are no matches.

The only way to do this right now is to use allMatches with a start index and then see if the result has any values and if so return the first one. This is rather awkward.

It would be cleaner if I could just use "firstMatch" with a start index. (For completeness, hasMatch and matchString also should have a start argument.)

Note that "matchAsPrefix" has a start index argument, but that doesn't help because it implies an anchored match at the start of the pattern. This would only work if the patterns all started with .*?, which they don't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.core-2library-coretype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions