-
Notifications
You must be signed in to change notification settings - Fork 242
Open
Description
It seems to me that the following expression:
VerbalExpression testRegex = regex()
.capture()
.find("abc")
.or("def")
.build();
should evaluate to the regex: /(?:((?:abc)|(?:(?:def))))/
, but instead it evaluates to: /(?:((?:abc))|(?:(?:def)))/
. As a result, if we test this expression against the string "def" it produces a match but no group is captured. This happens because the implementation of or() closes any opening parenthesis it finds in the string that precedes it.
I don't know why or() was implemented this way, but I believe the implementation of oneOf() I propose in #31 may fix this problem.
Metadata
Metadata
Assignees
Labels
No labels