많이 쓰는 예제들로 복습
[요소1요소2요소3]
(붙여서 이어쓰면 됨)[시작-끝]
.
import re
text = "전화번호는 010-1234-5678 연락해~"
pattern = r"\d{3}-\d{4}-\d{4}"
phone_namber = re.findall(pattern, text)
print(phone_namber) # 결과 값 : ['010-1234-5678']
import re
text = "이메일 주소 example@email.com 이야. 연락줘"
pattern = r"[a-zA-Z0-9._+-]+@[a-zA-Z0-9]+\.[a-zA-Z]{2,4}"
email = re.findall(pattern, text)
print(email) # 결과 값 : ['example@email.com']
```
좋은 글 감사합니다.