Skip to content

Commit 0796191

Browse files
authored
增加版二的作业的正则表达式
1 parent 87ae9ad commit 0796191

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

test37.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,12 @@
1717
g = re_mail.match(b)
1818
print(g.group())
1919

20+
21+
# 版本二:
22+
a = '<Tom Paris> tom@voyager.org => Tom Paris'
23+
b = 'bob@example.com => bob'
24+
mail = re.compile('([\w]+|[<>\w\s]+)@[\w]+.[\w]+')
25+
aa = mail.match(a)
26+
bb = mail.match(b)
27+
print(aa.group())
28+
print(bb.group())

0 commit comments

Comments
 (0)