Regex problems

G

George Ter-Saakov

I need a regular expression that would validate string like this.

aa5677

Any 2 literal characters and then any amount of digits from 1 to ...
aa345k is not valid.

Can someone write this for me.

Thanks
George.
 
G

Guest

I need a regular expression that would validate string like this.

aa5677

Any 2 literal characters and then any amount of digits from 1 to ...
aa345k is not valid.

Can someone write this for me.

Thanks
George.

^[a-zA-Z]{2}\d*$
 
G

George Ter-Saakov

Thanks, saved me one headache today :)

George.

Anon User said:
I need a regular expression that would validate string like this.

aa5677

Any 2 literal characters and then any amount of digits from 1 to ...
aa345k is not valid.

Can someone write this for me.

Thanks
George.

^[a-zA-Z]{2}\d*$
 
G

George Ter-Saakov

Yea, thanks
I figured that one myself
After an hour of reading MSDN I gave up and wrote to you guys. But now I
know something about Regex



George.

Anon User said:
any amount of digits from 1 to ...

Ah, change ( * ) to ( + ), like this

^[a-zA-Z]{2}\d+$

it will require at least one digit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top