>>> 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.
More Related Contents:
- Regex not matching all the paranthesis substrings [duplicate]
- python – regex search and findall
- Regular expression doesn't produce expected result
- How t extract last part of a text in python [duplicate]
- re.findall behaves weird
- Do regular expressions from the re module support word boundaries (\b)?
- Split a string by spaces — preserving quoted substrings — in Python
- Does “\d” in regex mean a digit?
- How to filter rows in pandas by regex
- Use Python’s string.replace vs re.sub
- Python regular expression re.match, why this code does not work? [duplicate]
- matching any character including newlines in a Python regex subexpression, not globally
- Python Regex to find a string in double quotes within a string
- How do I return a string from a regex match in python? [duplicate]
- Passing a function to re.sub in Python
- Splitting a string with repeated characters into a list
- How to combine multiple regex into single one in python?
- ip address validation in python using regex [duplicate]
- “Nothing to repeat” from Python regex
- Mass string replace in python?
- pandas applying regex to replace values
- regexes: How to access multiple matches of a group? [duplicate]
- Do Python regular expressions have an equivalent to Ruby’s atomic grouping?
- Finding words after keyword in python [duplicate]
- Grep and Python
- Regexp to remove specific number of occurrences of character only
- How do I verify that a string only contains letters, numbers, underscores and dashes? [duplicate]
- Python regex findall
- Python regex: matching a parenthesis within parenthesis
- Regexp finding longest common prefix of two strings