Study Notes (17): Python Interview 100 talking about (based Python3.x) - using regular expressions to determine whether a string contains a date ...

Learning immediately: https://edu.csdn.net/course/play/26755/340145?utm_source=blogtoedu

match match:

s='today is 2010-07-08'

m = re.match ( '* \ d {4} -. \ d {2} -. \ d {2} *', s). # where * represents multiple characters, \ d (4) represent 4 characters .

if m is not None :

    print(m.group())

Published 26 original articles · won praise 2 · Views 279

Guess you like

Origin blog.csdn.net/qq_35504363/article/details/104296015
Recommended