I’m new to regular expressions and for a project I’m working on I was required to validate a field to see if the 10 digit number entered contained all the same numbers.
I found the following solution:
([1-9])\\1{9}
source: http://www.coderanch.com/t/461871/java/java/Check-if-number-contains-all
I have tried to Google it, but nothing that explains what the expression is doing. I was wondering if someone could explain how this expression works.
It works like this:
Be sure that
0000000000shouldn’t match your expression since this isn’t matched by[1-9]