Created
November 26, 2011 23:31
-
-
Save pcarrier/1396505 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
LINK_MATCHER = re.compile(r""" | |
^ | |
(?P<num> [0-9] +?) : | |
\ (?P<name> [^:] +?) : | |
\ <(?P<flags> [^>] +?)> # uppercase, comma-separated list of flags | |
\ (?P<extra> . *?) # space-separated pairs of "key value" | |
\ *\\\ * | |
\ *link/(?P<link> [^ ] +?) | |
\ (?P<addr> [0-9a-f:] +?) | |
\ brd\ (?P<brd> [0-9a-f:] +?) | |
$ | |
""", re.X | re.M) | |
ADDR_MATCHER = re.compile(r""" | |
^ | |
(?P<num> [0-9] +?) : | |
\ (?P<name> [^ ] +) | |
\ + | |
(?P<type> [^ ] +) | |
\ (?P<addr> [^ ] +) | |
(?: | |
\ brd\ (?P<brd> [^ ] +) | |
)? | |
\ scope\ (?P<scope> [^ ] +) | |
(?: | |
\ (?P<alias> [^\\] [^ ] +) | |
)? | |
(?: | |
\ \\\ + | |
(?P<extra> . *?) | |
)? | |
$ | |
""", re.X | re.M) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment