RegEx - reusing subexpressions

后端 未结 6 1542
傲寒
傲寒 2020-11-28 12:56

Say I have a regex matching a hexadecimal 32 bit number:

([0-9a-fA-F]{1,8})

When I construct a regex where I need to match this multiple ti

6条回答
  •  爱一瞬间的悲伤
    2020-11-28 13:31

    To reuse regex named capture group use this syntax: \k or \k'name'

    So the answer is:

    (?[0-9a-fA-F]{1,8})\s*:\s*\k
    

    More info: http://www.regular-expressions.info/named.html

提交回复
热议问题