Created
April 7, 2025 04:07
-
-
Save bunsyy/b417808c183a341449e6cd837f3021f9 to your computer and use it in GitHub Desktop.
A gentle introduction to regular expression
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
text = "My phone number is 123-456-7890." | |
pattern = r"\d{3}-\d{3}-\d{4}" | |
match = re.search(pattern, text) | |
print(match.group()) # Output: 123-456-7890 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment