Skip to content

Matcher.groupCount behaviour inconsistent between JS and JVM #3280

Closed
@nrinaudo

Description

@nrinaudo

The following works fine under both platforms:

val matcher = Pattern.compile("\\d+").matcher("2147483647")

matcher.find()

matcher.groupCount

The following fails in js but not jvm:

val matcher = Pattern.compile("\\d+").matcher("2147483647")

//matcher.find()

matcher.groupCount

There's nothing in the Matcher scaladoc that seems to imply that calling find before groupCount is needed.

It does, however, seem like an unfixable bug. I'm no javascript expert, but it does rather look that regexes can only expose the group count for a given match, not for a matcher.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed bug. Needs to be fixed.help wantedThe core team will not work on this issue. Help from the community is wanted.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions