Skip to content

Infinite loop when using Matcher.namedGroups #19

@vprcic

Description

@vprcic

It seems that if the pattern matches an empty string, an infinite loop occurs when using Matcher.namedGroups, even if the matched input isn't an empty string. Here's a code example:

Pattern pattern = Pattern.compile("(?<first>A)?(?<second>B)?");
Matcher matcher = pattern.matcher("AB");
if(matcher.matches()) {
    matcher.namedGroups();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions