Java Regex validation for list of numbers -


I'm a newbie in Java Reggae

  "0000000000: = 10 points, user's This type is not allowed to input  

The number should be>, I'm asking for advice for this series of numbers checked "" 1111111111 "," 2222222222 ", "3333333333", "5555555544", "6666666666", "7777777777", "8888888888", "9999999999", "1234567890" "00000000000" "11111111111", "22222222222" "33333333333" "44444444444" "55555555555" "66666666666" "77777777777" "88888888888" "99999999999"

Currently my regex patterns Something like this

  ^ (? = \\ d {8,11} $) (?: (.) ​​\\ 1 *) $   

It recognizes all the numbers in the series, except for 1234567890 , any advice is appreciated. Thank you.

Use this:

  ^ (?! (\ D )       P> To validate in Java with , matching  we do not need anchor ?!  
  if (subjectString.matches ("((\\ d) \\ 1 + \\ b | 1234567890) \\ d {10,}")) {// match it! } And {// no, it was not matching ...}   

explanation

  • Negative look is
  • (\ d) \ 1+ \ b
  • <| Code> One digit (captured to group 1), whether by group 1, then a word boundary
  • or was followed by the repetition of the code> 1234567890
  • \ d {10,} matches ten digits or more

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -