Regex pattern to filter only 2 or more digits -


the entire password length 8 characters or more, 1 uppercase letter or more, ok.

i need regex pattern filter 2 or more digits. code doesn't work 2 digits:

(?=.*\d)(?=.*[a-z])(?=.*[a-z])).{8,} 

it allows 1 or more digits, need 2 or more digits.

i tried (both none of them work):

(?=.*\d{2})(?=.*[a-z])(?=.*[a-z])).{8,} (?=.*\d){2})(?=.*[a-z])(?=.*[a-z])).{8,} 

to require 2 more digits, add \d*\d first look-ahead:

^(?=.*\d\d*\d)(?=.*[a-z])(?=.*[a-z]).{8,}$ 

see demo

and idea use anchors ^ abd $ start , end of string.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -