match
only matches from the beginning of the string. Your code works fine if you do pct_re.search(line)
instead.
More Related Contents:
- How to use a variable inside a regular expression?
- Match a whole word in a string using dynamic regex
- How to check for valid email address? [duplicate]
- Case insensitive regular expression without re.compile?
- Python string.replace regular expression [duplicate]
- Split a string at uppercase letters
- Regex matching 5-digit substrings not enclosed with digits
- How to split but ignore separators in quoted strings, in python?
- Regular expression to extract URL from an HTML link
- BeautifulSoup – search by text inside a tag
- How to extract an IP address from an HTML string?
- Get the string within brackets in Python
- Split string based on a regular expression
- Split string on commas but ignore commas within double-quotes?
- How would I get everything before a : in a string Python
- Python regex: splitting on pattern match that is an empty string
- Python – Locating the position of a regex match in a string?
- How to find and replace nth occurrence of word in a sentence using python regular expression?
- Python unicode regular expression matching failing with some unicode characters -bug or mistake?
- How to split a string by commas positioned outside of parenthesis?
- Regex: match only outside parenthesis (so that the text isn’t split within parenthesis)?
- Faster way to remove stop words in Python
- Why doesn’t Python’s `re.split()` split on zero-length matches?
- Regular expression that finds and replaces non-ascii characters with Python
- How to validate an Email address in Django? [duplicate]
- Match groups in Python
- How to use python regex to replace using captured group? [duplicate]
- python regex first/shortest match
- What is the Python way of doing a \G anchored parsing loop?
- module ‘re’ has no attribute ‘findall’ [duplicate]