I am trying to use re2 .
import re print re.search('cde', 'abcdefg').group(0)
Result:
cde
But the result of re2 is different from
import re2 print re2.search('cde', 'abcdefg').group(0)
Result:
1 Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'NoneType' object has no attribute 'group'
- Why would
re2 print the number 1 with every new line pattern? - How to hide the number 1 ?
- Why is the result different from
re module (not found => return None)?
The re2 version is 0.2.20. and Python 2.7
thanks
source share