compilation - Regular Expression Format Confusion -
i'm trying head around regular expression later program compiler.
if have expression:
(a or b)*
is same a* or b*? or mean can choose or b 0 or more times.
for example, using regular expression, can generate {ababababa} or strings of {aaaaaaa} or {bbbbbbb}? if input symbol b mean b can occur 0 or more times or can occur second time too?
thanks much
in regex libraries, or operator spelled |, regex (a|b)*.
that indeed means "any string of length (including 0) made of as , bs". in other words, parentheses work in algebraic expression, define subexpression: * (postfix) operator applied subexpression a|b.
interesting fact: (a*b*)* same set of strings (a|b)*.
Comments
Post a Comment