re.findall("(100|[0-9][0-9]|[0-9])%", "89%")
This returns only result [89]
and I need to return the whole 89%. Any ideas how to do it please?
>>> 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With