I try to use re2.
import re
print re.search('cde', 'abcdefg').group(0)
Result:
cde
But re2 result is different
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'
re2
output number 1 when every execution new string pattern?re module
(not found => return None)?The re2 version is 0.2.20. and Python is 2.7
Thank you
This is a bug of version 0.2.20. See this issue or this one. You'd better clone the source from github and then install it. Don't install it via pip.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With