Skip to content

Runs out of memory, when no group is present in the regex #9

@TamasBarta

Description

@TamasBarta

Matcher.namedGroups() is faulty, because when I have no groups in my pattern, the while loop never quits, and causes out of memory exception.

Details: nextIndex is only updated in the for, but when parentPattern.groupNames() is empty, it never enters it.

My use case is to use your lib with dynamic regexes (I'm writing a regex capable router, that can extract parameters from URLs, so they may or may not contain groups), so I cannot determine without your lib if they have groups or not, so I cannot use the built-in regex, if I don't have groups.

Edit: I just discovered groupCount(), but still it would be nice if it wouldn't be needed.

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