Open links in new tab
    • Work Report
    • Email
    • Rewrite
    • Speech
    • Title Generator
    • Smart Reply
    • Poem
    • Essay
    • Joke
    • Instagram Post
    • X Post
    • Facebook Post
    • Story
    • Cover Letter
    • Resume
    • Job Description
    • Recommendation Letter
    • Resignation Letter
    • Invitation Letter
    • Greeting Message
    • Try more templates
  1. A password validation regex ensures that a password meets specific security rules such as length, inclusion of uppercase/lowercase letters, numbers, and special characters. This is commonly used in form validations to enforce strong password policies.

    Example:

    // Regex: 8-15 chars, at least 1 lowercase, 1 uppercase, 1 digit, 1 special char
    const regex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@.#$!%*?&])[A-Za-z\d@.#$!%*?&]{8,15}$/;

    console.log(regex.test("Geeks@123")); // true
    console.log(regex.test("GeeksforGeeks")); // false
    console.log(regex.test("Geeks123")); // false
    Copied!

    How it works:

    • ^ – Start of string

    • (?=.*[a-z]) – At least one lowercase letter

    • (?=.*[A-Z]) – At least one uppercase letter

    • (?=.*\d) – At least one digit

    • (?=.*[@.#$!%*?&]) – At least one special character from the set

    • [A-Za-z\d@.#$!%*?&]{8,15} – Only allowed characters, length between 8 and 15

    • $ – End of string

    Alternative with broader rules:

    Feedback
  2. Regular Expression for password validation - Stack Overflow

    Yes, and the main reason I pointed this out is that if your regex does NOT match then it may be made vastly more inefficient to determine this if you include unnecessary ".*"s in there!

    • Reviews: 1
    • How To Create a Password Validation Form - W3Schools

      Note: We use the pattern attribute (with a regular expression) inside the password field to set a restriction for submitting the form: it must contain 8 or more …

    • How to Use Regex for Password Validation in Javascript - Squash

      Apr 3, 2024 · Learn to set up password validation in Javascript using Regex, ensuring a minimum of eight characters, at least one number.

    • How to Validate Password Strength Using Regex and …

      Dec 27, 2022 · Now let's look at how we can use regex and JavaScript to validate the strength of a password. First, we can use a regex pattern to check that the …

    • Regular Expression for Password Validati... | ByteGoblin.io

      Password validation ensures that users create passwords that are not only strong but also meet certain criteria, improving overall security. In this article, we will discuss how to use regular expressions …

    • JavaScript : Password validation - w3resource

      Aug 19, 2022 · Here we validate various type of password structure through JavaScript codes and regular expression. Check a password between 7 to 16 characters which contain only characters, …

    • 7 Essential JavaScript RegEx Patterns for Data …

      Mar 1, 2025 · Master JavaScript RegEx data validation with this practical guide. Learn essential patterns for emails, passwords, dates, and more. Includes ready …

    • JavaScript & PHP Regex Validation Username, Email, …

      validate usernames, emails, dates, passwords, URLs, and mobile numbers using JavaScript and PHP Regex. Try the live demo and get validation code

    • JavaScript - How to Validate Form Using Regular Expression?

      Jul 23, 2025 · To validate a form in JavaScript, you can use Regular Expressions (RegExp) to ensure that user input follows the correct format. In this article, we'll explore how to validate common form fields …

    • People also ask
      Loading
      Unable to load answer
    By using this site you agree to the use of cookies for analytics, personalized content, and ads.Learn more about third party cookies|Microsoft Privacy Policy