Skip to content

Instantly share code, notes, and snippets.

@skarllot
Created September 14, 2013 17:23
Show Gist options
  • Save skarllot/6563843 to your computer and use it in GitHub Desktop.
Save skarllot/6563843 to your computer and use it in GitHub Desktop.
Python regex with named groups
import re
str = '{12948}>{$CPU_LOAD_MAX}'
m = re.search('(?:{)(?P<num>\d+)(?:})', str)
print(m.group('num')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment