Regex problems

  • Thread starter Thread starter George Ter-Saakov
  • Start date Start date
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.
 
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*$
 
Thanks, saved me one headache today :)

George.

Alexey Smirnov 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*$
 
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.

Alexey Smirnov 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
 
Back
Top