VerbalExpressions / VerbalExpressions/JavaVerbalExpressions
zeroOrMore() and oneOrMore() do not generat correct results
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 243
- Avg merge
- 26m
- Merged PRs (30d)
- 1
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating zeroOrMore(), oneOrMore(), and maybe() in the Java source, then compare how each method builds its regex fragment. Reproduce the examples from the issue and inspect existing tests, if present. Done means repetition applies to the complete added expression and the generated regex matches the expected grouped form for both methods.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100