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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:25:57+00:00 2026-06-18T15:25:57+00:00

i dont understand how regex works so this may be is a simple question

  • 0

i dont understand how regex works so this may be is a simple question for many people, but for me is very important that a person can explain me with simple words how can i use this.

i need to validate in jquery adding a new function

$.validator.addMethod("loginRegex",function(a,b){return this.optional(b)||/^[a-zA-Z\d]+$/.test(a)},"Solo se aceptan letras o numeros");

this function accept only letters and numbers, but if you put FH374HD3 the validate return me true, but i need to valid 4 letters and 4 numbers in that order, example: “ABCD4578”, only letters and numbers but 4 letters first and 4 numbers at the end.

is that posible??? tnx all!

  • 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-18T15:25:58+00:00Added an answer on June 18, 2026 at 3:25 pm

    This will match a string that is exactly 8 characters long that starts with exactly four letters and is followed by four numbers:

    /^[a-z]{4}\d{4}$/i
    

    This could also be written as:

    /^[A-Za-z]{4}\d{4}$/
    

    with the case insensitivity placed inline.

    • ^ matches the beginning of the string
    • [a-z] matches the letters from lower case a to lower case z
    • {4} matches the previous selection 4 times ([a-z][a-z][a-z][a-z] but in fewer characters)
    • \d matches digits (equivalent to [0-9])
    • {4} is as above (\d\d\d\d but in fewer characters)
    • $ matches the end of the string
    • i is the case-insensitivity flag so that [a-z] matches for capital letters as well.

    It should also be noted that this will not match for special characters such as é or à as they are not in the range [a-z].

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

Sidebar

Related Questions

Is this actually doable? I have some very long regex pattern rules that are
Ok so i dont understand regex checker works in ruby =~ 1.9.2p290 :009 >
I don't understand why this simple regex match does not return a match object.
I confess at the outset that I dislike and don't really understand regex properly.
according to this code i dont understand about NSClassFromString how did i know viewControllerName
I'm trying to understand the basic MVVM design approach, but I dont' understand where
So I'm not sure if I understand how this works and would like a
Could somebody explain how the following example works? I don't understand how this can
I know, I know, now I have two problems 'n all that, but regex
I dont understand why I am not able to update a field on the

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.