Skip to content

Instantly share code, notes, and snippets.

@lambdamusic
Created February 7, 2013 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lambdamusic/4734386 to your computer and use it in GitHub Desktop.
Save lambdamusic/4734386 to your computer and use it in GitHub Desktop.
Python: Python: simple REgex example
>>> s
'1/Mar/1215'
>>> pattern = r"(\d+)"
>>> re.match(pattern, s).groups()
('1',)
>>> pattern = r"(\d+)/(Sept|Mar)/(\d+)"
>>> re.match(pattern, s).groups()
('1', 'Mar', '1215')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment