Regex match multiple groups

前端 未结 2 1806
灰色年华
灰色年华 2021-01-13 02:02

I have the following example of a string with regex which I am trying to match:

Regex: ^\\d{3}( [0-9a-fA-F]{2}){3}

String to match: 010 00

2条回答
  •  情歌与酒
    2021-01-13 02:36

    This should work for your current string. I'd need a better example (more strings etc.) to see if this would break for those. The word boundary (\b) checks for any non-word character:

    \b[0-9a-fA-F]{2}\b
    

提交回复
热议问题