java中

时间:2017-03-22 07:12:12

标签: java regex annotations

如何为 pp-gfg76482_8498680983 创建@pattern正则表达式?

提前致谢。

1 个答案:

答案 0 :(得分:1)

你的正则表达式应如下所示:

\w{2}-\w{3}\d{5}_\d{10}

您可以查看Regex Demo

<强> Explination

pp-gfg76482_8498680983

\w{2}                       #Start with two characters
     -                      #Followed by a -
      \w{3}                 #Followed by 3 characters 
           \d{5}            #Followed by 5 digits
                _           #Followed by _
                 \d{10}     #Followed by 10 digits