Python re.search simple question
Jussi Piitulainen
jpiitula at ling.helsinki.fi
Mon Dec 8 02:08:27 EST 2014
Ganesh Pal writes:
> why is re.search failing in the below case ??
Your pattern, '... level-based: [prev 0 , now 1]', matches a literal
string '--- level-based: ' followed by 'p', 'r', 'e', 'v', ' ', '0',
..., or '1', none of which is the '[' found in your text at that
position.
Are you sure you need a regexp?
If you are, make your pattern r'... \[prev 0 , now 1\]'. The 'r' is
not a typo.
More information about the Python-list
mailing list