-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
Description
In Lexpy, ? means "zero or one character" and * means "zero or more characters". Based on this, why is the pattern ?* considered illegal while *? is allowed? Don't they both have the same semantics here:
*?: zero or more || zero or one -> zero || zero, zero || one, more || zero, more || one -> zero, one, more -> zero or more
?*: zero or one || zero or more -> zero || zero, zero || more, one || zero, one || more -> zero, more, one -> zero or more
The code at _utils.py#L15 already translates *? to *, why isn't this also done for ?*?
Line 51 in b69e029
| result = re.sub('(\*\?)+', '*', result) # Replace consecutive '*?' with a single group '*' |