第1关:正则表达式基础知识
import re
text = input()
#********** Begin *********#
#1.匹配字符单词 Love
print(re.findall(r'Love', text))
#2.匹配以 w 开头的完整单词
print(re.findall(r'\bw\w*', text))
#3.查找三个字母长的单词(提示:可以使用{m,n}方式)
print(re.findall(r'\b\w{3}\b', text))
#********** End **********#
第2关:re 模块中常用的功能函数(一)
import re
text = input()
#********** Begin *********#
#1.用compile方法,匹配所有含字母i的单词
pattern1 = re.compile(r'\b\w*i\w*\b'