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

  • Home
  • SEARCH
  • 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 6672603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:31:40+00:00 2026-05-26T03:31:40+00:00

Javascript regex to validate that it contains 6 characters and in which one character

  • 0

Javascript regex to validate that it contains 6 characters and in which one character (1) should be a number.

var pwdregex  =/^[A-Za-z1-9]{6}$/;
  • 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-26T03:31:40+00:00Added an answer on May 26, 2026 at 3:31 am

    This will guarantee exactly one number (i.e. a non-zero decimal digit):

    var pwdregex = /^(?=.{6}$)[A-Za-z]*[1-9][A-Za-z]*$/;
    

    And this will guarantee one or more consecutive number:

    var pwdregex = /^(?=.{6}$)[A-Za-z]*[1-9]+[A-Za-z]*$/;
    

    And this will guarantee one or more not-necessarily-consecutive number:

    var pwdregex = /^(?=.{6}$)[A-Za-z]*(?:[1-9][A-Za-z]*)+$/;
    

    All of the above expressions require exactly six characters total. If the requirement is six or more characters, change the {6} to {6,} (or remove the $ from {6}$).

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

Sidebar

Related Questions

I am using the following regex in .NET to validate that a string contains
In javascript how can i use regex to validate comma with characters. I'm doing
I have a javascript function that will validate a url function isValidUrl(textval){ var urlregex
I am writing a javascript code usign regex such that it validate license plate.
I need to validate phone or mobile number in javascript. It should match the
I'm using the following regexp to validate numbers in my javascript file: var valid
I've got a simple JavaScript regex check (written by other developer) that works perfectly
I would like to craft a case-insensitive regex (for JavaScript) that matches street names,
I am trying to validate a twitter url, so that at least it contains
I’m trying to validate a string which contains numbers where each four numbers are

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.