I need to check for users that are putting their id in the wrong input box.
They might enter the id as 123-456-789-012
or 123456789012
or some variation so I can't just check for digits. The length of the id varies slightly per user, but is always more than 10 digits.
Valid input is a mix of characters and 0-10 digits.
I've seen a lot of solutions for plain digits, but not mixed text. I tried variations of
(\D*\d){0,10}
but that didn't work.
You want "0-n non-digits" then "1-10 lots of a digit-and-any-non-digits":
^\D*(\d\D*){1,10}$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With