I am trying to make a regular expression that checks a field and make sure it includes (special characters or numbers) including all the other character as well. I am failing to do it correctly.
I’ve been using some regular expression sites like http://www.gskinner.com/RegExr/ to give me some help and make sure I’m getting the right thing, but I’m not.
The closest I’ve gotten is this:
(?!^[0-9]*$)(?!^[a-zA-Z!@#$%^&*()_+=<>?]*$)^([a-zA-Z!@#$%^&*()_+=<>?0-9]{6,15})$
It checks for everything although it is required that there is a number in it. But I need it to be required to have a number OR special character.
This requires a number AND a special character:
This requires a number OR a special character:
The pipe character ‘|’ means OR.
This one matches an entire line if there is both a special character AND a number:
This one matches an entire line if there is a special character OR a number: