Here's a small code, using python 3.4
import re
path_pattern=r'(([^\W]|[.~%$])+)'
re.search(path_pattern+'$','./').string
It will report AttributeError: 'NoneType' object has no attribute 'string'
on execution.
If I remove the +'$'
in the code, It works,
import re
path_pattern=r'(([^\W]|[.~%$])+)'
re.search(path_pattern,'./').string
As far as I know, $
is for matching the end of string, but why isn't it working here?