import re
batRegex = re.compile(r'Bat(wo)+man')
mo1 = batRegex.search('the adventures of Batwoman')
print(mo1.group())
mo2 = batRegex.search('the adventures of Batwowowoman')
print(mo2.group())
结果是:
Batwoman
Batwowowoman
import re
batRegex = re.compile(r'Bat(wo)+man')
mo1 = batRegex.search('the adventures of Batwoman')
print(mo1.group())
mo2 = batRegex.search('the adventures of Batwowowoman')
print(mo2.group())
结果是:
Batwoman
Batwowowoman
本文标题:正则_加号匹配一次或多从
本文链接:https://www.haomeiwen.com/subject/hroliftx.html
网友评论