praveen kumar praveen kumar - 2 months ago 7x
Objective-C Question

Password Validation Regular Expression - how to include special character?


I am using this regular expression for password validation which gives one upper case, one lowercase and a number. But what I want is a special character in it but it should optional but above mentioned must be mandatory.


This will allow these special characters: - (hyphen), * (asterisk) and _ (underscore).


If you want to add your own special characters, add them into this part of the regex [-*_0-9a-zA-Z] (inside the square bracket)