I need regex to check if a string contains 8 decimal digits or more. It can contain anything else and the digits don’t have to be consecutive.
Thanks in advance
EDIT: replaced “number” by “decimal digit” to match accepted answer.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Perhaps not the most elegant / efficient way to do it, but it works. Basically it will match eight decimals (optionally, with non-decimals between them). If there are more than eight, it will match too.
EDIT
As @Tomalak has pointed out,
[^\d]equals\Dby definition: