Does the regular expression X•(Y*+Z)
accept the word X
?
I would say it does, as Y=ε
should fulfill the disjunction, but I'm not sure.
Does the regular expression X•(Y*+Z)
accept the word X
?
I would say it does, as Y=ε
should fulfill the disjunction, but I'm not sure.
Yes, matching 0 times still counts as success.
Or, looking at it from the other direction, your regex generates
X
XY
XZ
XYY
XYYY
XYYYY
...
This answer is assuming that your regex could also be represented as X.(Y*|Z)
in addition to your original of X•(Y*|Z)
-- if that is not correct, please explain what •
is supposed to do or represent.
X•(Y*|Z)
necessitates that X
be present before Y*
or Z
can match, but will not include X
in the match's specific capture-group results, only the matching line. If you wanted to include X
, you might re-write it as (X)•(Y*|Z)
and extract X
from capture group 1, and your disjunction match in capture group 2.