Skip to content

Instantly share code, notes, and snippets.

@bunsyy
Created April 7, 2025 04:07
Show Gist options
  • Save bunsyy/b417808c183a341449e6cd837f3021f9 to your computer and use it in GitHub Desktop.
Save bunsyy/b417808c183a341449e6cd837f3021f9 to your computer and use it in GitHub Desktop.
A gentle introduction to regular expression
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