Created
September 14, 2013 17:23
-
-
Save skarllot/6563843 to your computer and use it in GitHub Desktop.
Python regex with named groups
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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