如果你使用 PyPi regex:
import regex
string = "<0,64000><1,207><2,460b0><3,38000><4,460b0><5,38000><6,460b0><7,38000><8,460b0><9,38000><a,460b0>"
print(regex.findall(r'<([[:xdigit:]]+),([[:xdigit:]]+)>', string))
见Python proof。 [[:xdigit:]]+ = [0-9A-Fa-f]+。所以,它等于
regex.findall(r'<([0-9A-Fa-f]+),([0-9A-Fa-f]+)>', string)
结果:[('0', '64000'), ('1', '207'), ('2', '460b0'), ('3', '38000'), ('4', '460b0'), ('5', '38000'), ('6', '460b0'), ('7', '38000'), ('8', '460b0'), ('9', '38000'), ('a', '460b0')]
说明
--------------------------------------------------------------------------------
< '<'
--------------------------------------------------------------------------------
( group and capture to \1:
--------------------------------------------------------------------------------
[[:xdigit:]]+ any character of: hexadecimal digits (a-
f, A-F, 0-9) (1 or more times (matching
the most amount possible))
--------------------------------------------------------------------------------
) end of \1
--------------------------------------------------------------------------------
, ','
--------------------------------------------------------------------------------
( group and capture to \2:
--------------------------------------------------------------------------------
[[:xdigit:]]+ any character of: hexadecimal digits (a-
f, A-F, 0-9) (1 or more times (matching
the most amount possible))
--------------------------------------------------------------------------------
) end of \2
--------------------------------------------------------------------------------
> '>'