XlogicX Blog

Regex_Is_Too_High_Level_-_Equivalent_Quantifiers

When talking about regular expression quantifiers like +, ?, *, and {x,y}, I like to logically relate them all to {x,y}. So:

a+ is similar to a{1,2147483647}

a* is similar to a{0,2147483647}

a? is similar to a{0,1}

On that last one, when considering the pros and cons between using a? or a{0,1}; this would be a pointless discussion. There not only is no logical difference (at least speaking for perl), there is absolutely no difference what so ever.


 

PoC: