I was trying to filter some data using regular expressions, and came with one example that doesn't compile in python, even though it seems to be a valid expression.
I have reduced it to its minimal form :
test=re.compile(r'[e-+]')
Calling this in Python 3.6.1, I get an error. I don't get an error with r'[e+-]'
, but I do get an error with r'[e-+]'
...
I don't understand why I get an error, because I know that '+' is a metacharacter, but in the manual : 'Metacharacters are not active inside classes'.
And I don't see why the order of the '-' and the '+' should matter ...