Skip to content

Instantly share code, notes, and snippets.

@eshafik
Last active January 4, 2020 16:42
Show Gist options
  • Select an option

  • Save eshafik/d0db778ff6f148369ca4d88434d6a394 to your computer and use it in GitHub Desktop.

Select an option

Save eshafik/d0db778ff6f148369ca4d88434d6a394 to your computer and use it in GitHub Desktop.
import re
text = "my phone number is 01740-999768"
phoneRegex = re.compile(r"(\d{5})-(\d{6})")
print(phoneRegex.search(text))
Output:
<re.Match object; span=(19, 31), match='01740-999768'>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment