`import re hh = re.compile(r"(\w{7}@\w{5}.\w{3})|(\w{4}.\w{5}@\w{9}.\w{3})") print(hh.match("someone@gmail.com").group(1)) print(hh.match("bill.gates@microsoft.com").group(2))
fhh = re.compile(r"(\w+.?\w+@\w+.\w+)") print(fhh.match("sfdsfaa@dfafd.com").group()) print(fhh.match("dsfds.sdf@sdfa.com").group())
得到 someone@gmail.com bill.gates@microsoft.com sfdsfaa@dfafd.com dsfds.sdf@sdfa.com 在此插入代码
```
Sign in to make a reply
渡俊
`import re hh = re.compile(r"(\w{7}@\w{5}.\w{3})|(\w{4}.\w{5}@\w{9}.\w{3})") print(hh.match("someone@gmail.com").group(1)) print(hh.match("bill.gates@microsoft.com").group(2))
fhh = re.compile(r"(\w+.?\w+@\w+.\w+)") print(fhh.match("sfdsfaa@dfafd.com").group()) print(fhh.match("dsfds.sdf@sdfa.com").group())
得到 someone@gmail.com bill.gates@microsoft.com sfdsfaa@dfafd.com dsfds.sdf@sdfa.com 在此插入代码
```