Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Regex problems

Reply
Thread Tools

Regex problems

 
 
George Ter-Saakov
Guest
Posts: n/a
 
      08-16-2007
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.


 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      08-16-2007
On Aug 16, 8:35 pm, "George Ter-Saakov" <(E-Mail Removed)> wrote:
> 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*$

 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      08-16-2007
On Aug 16, 8:35 pm, "George Ter-Saakov" <(E-Mail Removed)> wrote:
> any amount of digits from 1 to ...


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

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

it will require at least one digit

 
Reply With Quote
 
George Ter-Saakov
Guest
Posts: n/a
 
      08-16-2007
Thanks, saved me one headache today

George.

"Alexey Smirnov" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> On Aug 16, 8:35 pm, "George Ter-Saakov" <(E-Mail Removed)> wrote:
>> 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*$
>



 
Reply With Quote
 
George Ter-Saakov
Guest
Posts: n/a
 
      08-16-2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> On Aug 16, 8:35 pm, "George Ter-Saakov" <(E-Mail Removed)> wrote:
>> any amount of digits from 1 to ...

>
> Ah, change ( * ) to ( + ), like this
>
> ^[a-zA-Z]{2}\d+$
>
> it will require at least one digit
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How make regex that means "contains regex#1 but NOT regex#2" ?? seberino@spawar.navy.mil Python 3 07-01-2008 03:06 PM
String Pattern Matching: regex and Python regex documentation Xah Lee Java 1 09-22-2006 07:11 PM
Is ASP Validator Regex Engine Same As VS2003 Find Regex Engine? =?Utf-8?B?SmViQnVzaGVsbA==?= ASP .Net 2 10-22-2005 02:43 PM
Java regex imposture re: Perl regex compatibility a_c_Attlee@yahoo.com Java 2 05-06-2005 12:16 AM
perl regex to java regex Rick Venter Java 5 11-06-2003 10:55 AM



Advertisments