Click here to Skip to main content
15,881,687 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi All,

In my current project i have one requirement i.e.

I have to enter post code 7 letters.....In that first letter is Alphabet,second one is Numeric,third one Alphabet, fourth one is space ,fifth one is alphabet,sixt one is numeric and seventh one is Alphabet....

How can i achieve using regular expression in java script.....

Please suggest!!!!!

Thanks,
Codehub.
Posted

1 solution

[a-zA-Z]\d[a-zA-Z]\s[a-zA-Z]\d[a-zA-Z]

[a-zA-Z] means match any alphabet case in-sensitive
\d means match any digit
\s means match a white space
If you want to impose case sensitivity to the alphabets, try modify it yourself, quite intuitive.
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900