javascript - Regex c# to jquery implementation -


i have regex on asp.net mvc3 application:

regex pattern = new regex(@"^(?!.*(.)\1\1)(?=.*\d)(?=.*[a-z])(?=.*[a-z])[0-9a-za-z]{8,20}$"); 

i needed implement jquery due requirements this:

password.match(/(.*(?=.*\d)(?=.*[a-z])(?=.*[a-z])[0-9a-za-z]/)) 

this working. detect if 1 uppercase, 1 lowercase , 1 number present on password. , have need detect if 3 consecutive letter present (eg: aaa, bbb).

with regex on c# , working of:

/(.)\1\1/ 

but can't make work on password.match(/(.)\1\1/)

did missed here? in advance!

i've copied c# regex , tried in javascript console , works great:

"waweeead2".match(/^(?!.*(.)\1\1)(?=.*\d)(?=.*[a-z])(?=.*[a-z])[0-9a-za-z]{8,20}$/) 

returns ["waweeead2", undefined] and

"waweeeead2".match(/^(?!.*(.)\1\1)(?=.*\d)(?=.*[a-z])(?=.*[a-z])[0-9a-za-z]{8,20}$/) 

returns null.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -