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 8680895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:21:58+00:00 2026-06-12T21:21:58+00:00

OK so I’m trying to preg_match a string (an entered password) with a regular

  • 0

OK so I’m trying to preg_match a string (an entered password) with a regular expression but after hours of reading/watching regexp info on the internet I still don’t understand it..

I currently have:
‘/^[A-Z]^[a-z]+$/’

The password must:

Be between 8 and 16 characters.
Contain at least 1 Upper case letter
Contain at least 1 Lower case letter
Contain at least 1 number

If you could also include a regular expression with all of the above requirements but also with
Contain at least 1 symbol

for my own learning I’d be grateful.
Please try and explain your Regular Expression so that maybe I can understand it. Thanks!

  • 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-06-12T21:21:59+00:00Added an answer on June 12, 2026 at 9:21 pm
    1. Between 8 and 16 characters:

      ^.{8,16}$
      
    2. At least one uppercase letter

      (?=.*[A-Z])
      
    3. At least one lowercase letter

      (?=.*[a-z])
      
    4. At least one number

      (?=.*\d)
      

    Putting it together:

    ^(?=.*[A-Z])(?=.*[a-z])(?=.*\d).{8,16}$
    

    If you want a Unicode-aware variant (probably futile with PHP, I know):

    ^(?=.*\p{Lu})(?=.*\p{Ll})(?=.*\p{Nd}).{8,16}$
    

    This works by having a number of positive lookahead assertions at the beginning, each of which checking one desired property of your string. Lookahead assertions check whether the part in parentheses could match at this position, but won’t advance the actual match position in the string. The actual match here just makes sure the length matches your requirement.

    Note though, that this should essentially be computationally the same as several regex matches checking for each of the properties. It’s just packaged in a single regex.

    Oh, and at least one symbol can be checked likewise with (?=.*[,.!?]) or something similar, depending on what you consider a symbol.

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

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
Specifically, suppose I start with the string string =hello \'i am \' me And

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.