RegEx pattern any two letters followed by six numbers

前端 未结 5 1196
灰色年华
灰色年华 2020-11-30 00:36

Please assist with the proper RegEx matching. Any 2 letters followed by any combination of 6 whole numbers.

These would be valid: 
RJ123456
PY654321
DD3212         


        
5条回答
  •  情歌与酒
    2020-11-30 01:23

    Depending on if your regex flavor supports it, I might use:

    \b[A-Z]{2}\d{6}\b    # Ensure there are "word boundaries" on either side, or
    
    (?

提交回复
热议问题