Regular expressions that match 5 to 10 non repeating digits


For repeated 5 to 10 digit numbers, you can use a regular pattern such as {5,10}

No repetition of 5 to 10 digits, I think about it, not yet, but I have to check the Internet.

There was a good version, but regexbuddy passed the test anyway.

Copy codeThe code is as follows:

For (?!…) (…… )……… \1) I haven’t studied this form thoroughly. I really need to study it carefully when I have time.

The previous example of PHP:

Copy codeThe code is as follows:
$str = ‘123456789’;
$search = ‘/^(?!\d*?(\d)\d*?\1)\d{5,10}$/’;
$result = preg_match($search,$str);

Echo ‘matches 5 to 10 digits without repetition < br / >’;
if($result>0) {
Echo ‘consistent’;
}else {
Echo ‘does not conform’;