Skip to content

Instantly share code, notes, and snippets.

@ZhouYang1993
Created April 19, 2020 22:55
Show Gist options
  • Save ZhouYang1993/fbf17b325d2a8e1eb88e711f4fc8b885 to your computer and use it in GitHub Desktop.
Save ZhouYang1993/fbf17b325d2a8e1eb88e711f4fc8b885 to your computer and use it in GitHub Desktop.
Regex in Python
import re
re_three_numbers = re.compile(r'^\d{3}$')
re_three_numbers.match('123')
# <_sre.SRE_Match object; span=(0, 3), match='123'>
re_three_numbers.match('12345')
# None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment