lisa21
0
Q:

re python

#re findall
>>> import re  
# A sample text string where regular expression is searched.  
>>> string = """Hello my Number is 123456789 and  
             my friend's number is 987654321"""
    
# A sample regular expression to find only digits.  
>>> regex = '\d+'             
    
>>> match = re.findall(regex, string)  
>>> print(match) 
['123456789', '987654321']
6
import re
>>> m = re.search('(?<=abc)def', 'abcdef')
>>> m.group(0)
'def'
3
parse("Today is Dec 1 16", fuzzy_with_tokens=True)
 
parse("Today is Dec 1 14", fuzzy_with_tokens=True)
 
parse("Today is Nov 30 12", fuzzy_with_tokens=True)
0
from dateutil.parser import parse
 
parse("Today is 12-01-18", fuzzy_with_tokens=True)
-1

New to Communities?

Join the community