>>> re.findall("(?:100|[0-9][0-9]|[0-9])%", "89%")
['89%']
When there are capture groups findall
returns only the captured parts. Use ?:
to prevent the parentheses from being a capture group.
>>> re.findall("(?:100|[0-9][0-9]|[0-9])%", "89%")
['89%']
When there are capture groups findall
returns only the captured parts. Use ?:
to prevent the parentheses from being a capture group.