Python学习随记(十二):正则表达式
import re
a = 'wy'
print(re.match('wy', a))
print(re.match('\d\d\d', '012'))
print(re.match('\w\w\w', '01A'))
print(re.match('...', 'w12'))
print(re.match('\s\s\s\s', ' \n\t\f'))
print(re.match('\d{11}', '0123413131231'))
print(re.match('\d{8,11}', '0123413131231'))
print(re.match('\d{3,4}-\d{7}', '010-1234567'))
print(re.match('[a-zA-Z_]\w*', 'a_bssssssssss'))
print(re.match('[Pp]ython', 'python'))
s = 'ABC\\-001'
print(re.match(r"\w+\\-\d+", s))
s = "Hello 1234567 is a number. Regex String"
print(re.match("Hello (\d*).*", s))