Quantifiers in regexp?

Zdravstvuite! Please explain the following point. Try using re.match to parse a string of form "number(1 or 2)character....." (eg. "9c..." or "25F...."). Why don't the three pattern versions:
r'^[0-9]{1;2}.+$'
r'^(\d){1;2}.+$'

And only option
r'^\d\d?.+?'
Is the quantifier {1;2} in this case is not sanache that match() should look for one OR two matches, and only if they are not, or there are more than 2, return None?
March 19th 20 at 08:51
1 answer
March 19th 20 at 08:53

Find more questions by tags Regular expressionsPython