How to represent a fix number of repeats in regular expression?

后端 未结 4 1668
北荒
北荒 2021-02-01 12:06

I am wondering if there is a better to represent a fix amount of repeats in a regular expression. For example, if I just want to match exactly 14 letters/digits, I am using

4条回答
  •  爱一瞬间的悲伤
    2021-02-01 12:43

    In Java create the pattern with Pattern p = Pattern.compile("^\\w{14}$"); for further information see the javadoc

提交回复
热议问题