Search code examples
regexkleene-star

Does the kleene-star's potence 0 fulfill a disjunction?


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.


Solution

  • 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
    ...