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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:36:57+00:00 2026-05-28T02:36:57+00:00

I am creating a registration form. I want to use the placeholder attribute on

  • 0

I am creating a registration form.
I want to use the placeholder attribute on a password input to explain, in part, what type of regex is used for validation, using the pattern attribute.

This is the regex i found at http://www.html5pattern.com :

(?=^.{6,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$

The explanation for this regex was as follows:

Password (UpperCase, LowerCase, Number/SpecialChar and min 6 Chars)

The example i have used in the placeholder attribute, along with the title attribute, is this : Examp1e.
I would like to ensure that a user does not specifically enter “Examp1e” as their password.
Does anyone have any advice, suggestions, or input as to how i should go about this task?

  • 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-28T02:36:58+00:00Added an answer on May 28, 2026 at 2:36 am

    That regex you started with is bad. For one thing, JavaScript’s \W is equivalent to [^A-Za-z0-9_]: any character that isn’t an ASCII word character. That includes all of the ASCII punctuation, whitespace and control characters, plus all non-ASCII characters. There’s no official definition for “special characters” that I know of, but I’m pretty sure this is not what the author meant.

    To move this along, I’ll assume only ASCII characters are allowed in the password, and that “special characters” refers to punctuation characters:

    [!"#$%&'()*+,\-./:;<=>?@\[\\\]^_`{|}~]
    

    That would make the regex

    ^(?=[!-~]{6,20}$)(?=.*[A-Z])(?=.*[a-z])(?=.*[\d!"#$%&'()*+,\-./:;<=>?@\[\\\]^_`{|}~]).*$
    

    Notes:

    • Notice how I pulled the ^ out of the first group; it’s there to anchor the whole regex, not just that one lookahead.

    • I also merged the “digits” and “specials” lookaheads into one. It’s not a big deal in this case, but one of my rules thumb is that you should never use an alternation if a character class will do the job.

    • [!-~] is an old Perl idiom for any “visible” ASCII character (i.e., anything but whitespace or control characters).

    • I haven’t the slightest idea what the original author was trying to do with that (?![.\n]).

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

Sidebar

Related Questions

I'm creating a registration form using validation inside the User model such as validates_confirmation_of
I'm creating a registration form and want to check to see if an email
i am creating a registration form for that i want to implement the captcha
I am currently creating a registration form in asp.net and c#. What I want
I'm creating registration page and I've done basic client side (JS) form validation. Now
I am creating a registration form which contains two submit buttons. I need to
I am creating an user registration form using jsp,in which there is an option
I am creating a registration page in HTML, PHP, and MySQL. I want to
I have such view that handles user registration. After creating new user i want
I am creating a user registration form, and there is an option to select

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.