import re
text = "hello, world!"
pattern = r"[a-z]+"
match = re.findall(pattern, text)
print(match) # ['hello', 'world']
import re
text = "My email is john@example.com"
pattern = r"(\w+)@(\w+.\w+)"
match = re.search(pattern, text)
print(match.group(0)) # john@example.com
print(match.group(1)) # john
print(match.group(2)) # example.com
标签: VScode