判断字符串是否匹配
import re
def is_matched(string):
return True if re.match(r'your regex',string) else False
如果匹配, re.match()
会返回一个match对象
<_sre.SRE_Match object; span=(0, 0), match=''>
否则返回None
待续...
import re
def is_matched(string):
return True if re.match(r'your regex',string) else False
如果匹配, re.match()
会返回一个match对象
<_sre.SRE_Match object; span=(0, 0), match=''>
否则返回None
待续...