Artem Artem - 3 months ago 4x
Python Question

Why python re module does not work with @?

In the following example shows weird problem: Python pattern does not work.

import re
data = r'blah blah @Component blah blah'
m = re.match(r'\@Component', data)
print m

It would print out:


What did I miss here?


You need to use instead, and @ has no special meaning so you do not need to escape it.

>>>'@Component', data).group()