RegEx Subroutines
当你想多次使用次抑郁症而不重写时,你可以将其称为<>次>。 可根据姓名、指数或相对位置指定替代企业。
辅助设施由个人防护中心、Perl、Ruby、PHP、Delphi、R等机构提供支助。 不幸的是,网络框架缺乏,但有一些免费图书馆。 https://github.com/ltrzesniewski/pcre-net rel=“noretinger”https://github.com/ltrzesniewski/pcre-net。
Syntax
这里指的是非常规工作:请说的是,你希望连续三次重复使用<条码>。
Standard RegEx
Any: [abc][abc][abc]
Subroutine, by Name
Perl: (? name [abc])(?&name)(?&name)
PCRE: (?P<name>[abc])(?P>name)(?P>name)
Ruby: (?<name>[abc])g<name>g<name>
Subroutine, by Index
Perl/PCRE: ([abc])(?1)(?1)
Ruby: ([abc])g<1>g<1>
Subroutine, by Relative Position
Perl: ([abc])(?-1)(?-1)
PCRE: ([abc])(?-1)(?-1)
Ruby: ([abc])g<-1>g<-1>
Subroutine, Predefined
This defines a subroutine without executing it.
Perl/PCRE: (?(DEFINE)(? name [abc]))(?P>name)(?P>name)(?P>name)
Examples
Matches a valid IPv4 address string, from 0.0.0.0 to 255.255.255.255:
((?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9])).(?1).(?1).(?1)
Without subroutines:
((?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9])).((?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9])).((?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9])).((?:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))
And to solve the original posted problem:
(?<from>(?P<hexnum>[0-9a-fA-F]{1,8}))s*:s*(?<to>(?P>hexnum))
More Info
http://regular-expressions.info/subroutine.html
http://regex101.com/