regular expression - password policy enforcement

Hello Experts,

I need a regular expression string that matches (1 capitol, 1 lowercase, 1 number, 1 special character)

I had this:

which seemed to be working until I added the '#' character to the string at which point it quits. Unfortunately this problem got missed until about a week away from production so I am reaching out...

Any help appreciated!
I am using this expression with the PCRE engine.
Who is Participating?
alainbrydenConnect With a Mentor Commented:
This regular expression seems to have everything you need. If you don't require at least 10 characters you can remove that first part:


    * Must be at least 10 characters
    * Must contain at least one one lower case letter, one upper case letter, one digit and one special character
    * Valid special characters (which are configurable) are -   @#$%^&+=

Well it looks like your problem might be that in the PCRE documentation, comments are delimited by the # mark. Maybe you need to escape it by using it twice? (##)
I stand corrected, apparently using \# to escape the hash character should take care of it.
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Here's the man page for your reference:
The relevant section for the # problem has the header "BACKSLASH"
By the way, you may also want to escape $ sign, otherwise Perl will expand $^ variable.
glo-dbaAuthor Commented:
Your string works fine. My string doesn't work. It may be may an inconsistency in the "regex buddy" PRCE engine.

Thank you very much!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.