regex - How to parse for tags with '+' in python -
When I try to compile it, I get the "Nothing to Repeat" error:
search = re.compile (r '([^ a-zA-Z0- 9]) (% s) ([^ a-zA-Z0- 9])'% '+ test', re I)
The problem is '+' How do I manage it?
re.compile (r '([^ a-zA -Z0- 9]) (% S) ([^ a-zA-Z0-9]) '%' \ test ', re.I)
"+" In the regular expression the quantifier "is less than Repeat at least once "It has to be followed by something repetitive, or if you want to match it with a literal" + "then it must be saved.
Better, if you want to make your regex dynamically
re.compile (r '([^ a-zA-Z0- 9]) (% s) ([^ a-zA-Z0- 9])'% re.escape ( '+ Test'), re.i)
Comments
Post a Comment