By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,677 Members | 1,060 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,677 IT Pros & Developers. It's quick & easy.

Query related to regular expression

P: 50

I am having a form in which one field need to be in the format of AAA1234

and I need to do validation for it, can anyone help me out with the code how to do this.

For the format 1234AA, I used ^\d{4}[a-z]{2}$ and it is working fine but for the alternate case I used ^\[a-z]{3}d{4}$ but it is not working.

Thanks in advance.

Jan 30 '08 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 5,327
hi ...

there is a small mistake with the backslash and may be with the upper cases i think ... use:

Expand|Select|Wrap|Line Numbers
  1. /^[a-zA-Z]{3}\d{4}$/.test('AAA1234');
to match the pattern you gave.

kind regards
Jan 30 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.