Skip to content

zeroOrMore() and oneOrMore() do not generat correct results #36

Description

@Tavio

The expression:

regex().add("Java").zeroOrMore().build();

should generate the regex: /(?:Java)*/, just as the expression:

regex().maybe("Java").build();

generates the regex: /(?:Java)?/. However, the first expression actually generates the regex: /Java*/, which is not correct. The oneOrMore() method suffers from the similar problem.

I propose to change both zeroOrMore() and oneOrMore() to accept a string, much as the maybe() method does so it can return the correct result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions