I need a regex to match the following rules.
1. Atleast 1 numerical character.
2. Atleast 1 of these (!, @, #, $, %, _) non-alphanumeric characters.
3. Uppercase alphabets.
4. Lowercase alphabets
I tried creating a pattern as below, but the thing is any of the characters can be in any position. I am kind of stuck here.
^[[A-Z]+[a-z]+[0-9]+[!@#\\$%_]+]$
These should satisfy each of the above conditions.
1. [0-9]+
2. [!@#\\$_%]+
3. [A-Z]+
4. [a-z]+
But how do I group them together so that they can be occur in any order but each group occurs atlest once.
SOLUTION :
^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[!@#$%_])[A-Za-z0-9!@#$%_]*$