DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Thu, 16 Aug 2007 14:35:17 -0400,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    George Ter-Saakov
          2    Alexey Smirnov
          3    Alexey Smirnov
          4    George Ter-Saakov
          5    George Ter-Saakov


Regex problems   
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.
Date:Thu, 16 Aug 2007 14:35:17 -0400   Author:  

Re: Regex problems   
On Aug 16, 8:35 pm, "George Ter-Saakov"  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*$
Date:Thu, 16 Aug 2007 11:41:36 -0700   Author:  

Re: Regex problems   
On Aug 16, 8:35 pm, "George Ter-Saakov"  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
Date:Thu, 16 Aug 2007 11:43:55 -0700   Author:  

Re: Regex problems   
Thanks, saved me one headache today :)

George.

"Alexey Smirnov"  wrote in message 
news:1187289696.573266.278400@k79g2000hse.googlegroups.com...

> On Aug 16, 8:35 pm, "George Ter-Saakov"  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*$
> 
Date:Thu, 16 Aug 2007 14:46:40 -0400   Author:  

Re: Regex problems   
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"  wrote in message 
news:1187289835.035382.194800@22g2000hsm.googlegroups.com...

> On Aug 16, 8:35 pm, "George Ter-Saakov"  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
> 
Date:Thu, 16 Aug 2007 14:59:45 -0400   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us