Link to home
Start Free TrialLog in
Avatar of Kokoglen
KokoglenFlag for United States of America

asked on

Regular Expression - Repeating characters

I am validating client-side passwords per a customers requirements.  I have all except one.

Need a regular expression where it will return a result of false if the string has 3 repeating characters in a row anywhere in the string.
Must be regular expression, but I am interested in any solutions...pulling hair out currently.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of GwynforWeb
GwynforWeb
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of arantius
arantius

Kokoglen,

The regular expression you're looking for is:
/.{3,}/

Do you need help implementing a regular expression in JS?
/.{3,}/  will return detect strings of length 3 or more not repeating chars
My mistake ... that will match any string of 3 or more characters.  Forget my answer =)
Avatar of Kokoglen

ASKER

Works good.  Thank you.  I actually shouldve asked the question in the Java or JSP question as I need to apply it to struts, but this will get me started.  Thank you again.