searchString = "010-123456780"
regular = r"^010-\d{8}"
print(re.findall(regular,searchString))
*代表,将前面的字符,重复零到多次
+代表,一次到多次
?代表一次或者零次
regular = r"^010-\d*"
regular = r"^010-[0-9]+"
regular = r"^010-[0-9]?"
regular = r"^010-?\d{0,8}"
匹配电话号码
regular_tel = r"\d{3,4}-?\d{8}"
regular_tel = re.compile(regular_tel)
print(re.findall(regular_tel,searchString))
searchString = "csvt hellp csvt hello csvt csvt "
csvt_re = re.compile(r"csvt",re.I)
print(csvt_re.findall(searchString))
x = csvt_re.match(searchString)
print(x.group())
s = "hello csvt"
regular = r"c..t"
s = re.sub(regular,"python",s)
print(s)
email_regular = r"\w{3}@\w+(.com|.cn)"
print(re.match(email_regular,"zzz@123.com"))