> amk wrote: > > outside a character class it's a character if there are exactly > > 3 octal digits; otherwise it's a backref. So \41 is a backref > > to group 41, but \041 is the literal character ASCII 33. > > so what's the right way to parse this? > > read up to three digits, check if they're a valid octal > number, and treat them as a decimal group number if > not? Suggestion: If there are fewer than 3 digits, it's a group. If there are exactly 3 digits and you have 100 or more groups, it's a group -- too bad, you lose octal number support. Use \x. :-) If there are exactly 3 digits and you have at most 99 groups, it's an octal escape. (Can you even have more than 99 groups in SRE?) --Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4