Skip to content

Instantly share code, notes, and snippets.

@davedash
Created May 3, 2012 15:53
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 davedash/2586745 to your computer and use it in GitHub Desktop.
Save davedash/2586745 to your computer and use it in GitHub Desktop.
Match string formatting in python strings.
re.findall(r'(?:\%\([^\)]+\)(?:s|d)|\%(?:s|d)|{[^}]+})', u'Hi %(you)ss there %(yo)s %(num)d' ' Beef %d %s' '{meat} rules {who}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment