0

I have the following Regex expressions:

  • check length: [\w\W]{8,}

  • has letters & digits: (?=.*[a-zA-Z])(?=.*[0-9])

  • has letters and special chars: [\a-zA-z]{1,}[@#$!%^&*]{1,}

  • has digits and special chars: [\d]{1,}[@#$!%^&*]{1,}

  • has a digit or letter 4 or more times in a row: ([a-z0-9])\1{3,}

I would like to join them into one single regex:

(check length) && (has letters & digits || has letters and special chars || has digits and special chars) && has a digit or letter 4 or more times in a row

Is there a way to take these patterns and concatenate them into one single regex expression?

Ivan
  • 34,531
  • 8
  • 55
  • 100
TKDev
  • 493
  • 1
  • 4
  • 19
  • https://www.google.nl/search?q=javascript+%22regular+expression%22+OR+regex+OR+regexp+password+validation+example - here is the principle https://stackoverflow.com/questions/5142103/regex-to-validate-password-strength – mplungjan Jul 08 '18 at 13:44
  • That's a weird rule: "has a digit or letter 4 or more times in a row" – wp78de Jul 08 '18 at 22:30
  • Thats what the product designers want, no number or charachter repeating for more than 3-4 times... – TKDev Jul 09 '18 at 07:43

0 Answers0