Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6816865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:58:38+00:00 2026-05-26T20:58:38+00:00

Ok so I am writing a password checker for our password policy which requires

  • 0

Ok so I am writing a password checker for our password policy which requires 3 of the 4 major classifications. Where I’m having problems with is the special character match.

Here’s what I have thus far:

private function PasswordRequirements($ComplexityCount) {
    $Count = 0;
    if(preg_match("/\d/", $this->PostedData['password']) > 0) {
        $Count++;
    }
    if(preg_match("/[A-Z]/", $this->PostedData['password']) > 0) {
        $Count++;
    }
    if(preg_match("/[a-z]/", $this->PostedData['password']) > 0) {
        $Count++;
    }
    // This is where I need help
    if(preg_match("/[~`!@#$%^&*()_-+=\[\]{}\|\\:;\"\'<,>.]/", $this->PostedData['password']) > 0) {
        $Count++;
    }

    if($Count >= $ComplexityCount) {
        return true;
    } else {
        return false;
    }
}

So basically what I’m doing is checking the string for each case, numbers, uppercase, lowercase, and special characters. We don’t have any restrictions on any special character and I also need unicode characters. Does the \W work in this case or would that also include numbers again? I can’t find great documentation on \W so I’m unclear on this part.

Does anyone know of a easy regexp that would cover all special characters and unicode characters that does not include numbers and letters?

Anyone is free to use this as I think more than a few people have been looking for this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:58:39+00:00Added an answer on May 26, 2026 at 8:58 pm

    This pattern would allow all characters that’s not a digit or a-Z.

    [^\da-zA-Z]
    

    Regarding the \W it’s a negated \w, which is the same as [A-Za-z0-9_]. Thus will \W be all characters that’s not an english letter, digit or an underscore.

    As I mentioned as a comment this is a great resource for learning regex. And here’s a good site to test the regex.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a password-reset page for my website. Here's my idea: a. User
I am writing an Android app which submits a username and password to a
I'm writing a password strength checker in PHP, and I'm using Regular Expressions to
I'm writing a plugin which needs to check if a given username and password
i am writing C# function now, which must return me user password. All is
Writing documentation in html requires some code examples. What to do with characters that
I am writing the regex for validating password in Javascript. The constraints are: Password
I am writing a WCF Service that will require a username and password authentication,
I am currently writing a php script that validates a username and password. I
I am writing a script that prompts the logged in user for their password

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.