RegEx to make sure that the string contains at least one lower case char, upper case char, digit and symbol

What is the regex to make sure that a given string contains at least one character from each of the following categories.

  • Lowercase character
  • Uppercase character
  • Digit
  • Symbol

I know the patterns for individual sets namely [a-z], [A-Z], \d and _|[^\w] (I got them correct, didn’t I?).

But how do I combine them to make sure that the string contains all of these in any order?

4 Answers
4

Leave a Comment