Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Tue, 22 Jul 2008 13:01:10 -0700,    group: microsoft.public.dotnet.languages.csharp        back       


RegEx Format Help   
Prior to now, my RegEx expression was as follows:

RegEx pattern = new Regex(@"[BCX][P057]\d{5} \d{4} \d{2}");

That has worked, but now I have been asked to enable the ability for our 
expressions to include an underscore ('_') at each of the character 
positions. (This is an SQL Query, and the underscore acts as a wildcard for 
individual characters)

Is there a nice way to modify my RegEx expression to include the underscore 
in a smart manner? (I'm not very good at creating RegEx expressions)
date: Tue, 22 Jul 2008 13:01:10 -0700   author:   jp2msft

Re: RegEx Format Help   
jp2msft wrote:
> Prior to now, my RegEx expression was as follows:
> 
> RegEx pattern = new Regex(@"[BCX][P057]\d{5} \d{4} \d{2}");
> 
> That has worked, but now I have been asked to enable the ability for our 
> expressions to include an underscore ('_') at each of the character 
> positions. (This is an SQL Query, and the underscore acts as a wildcard for 
> individual characters)
> 
> Is there a nice way to modify my RegEx expression to include the underscore 
> in a smart manner? (I'm not very good at creating RegEx expressions)

RegEx pattern = new Regex(@"[BCX_][P057_]\d{5} \d{4} \d{2}");

?

Or do you want underscore support for the digits as well ?

Arne
date: Tue, 22 Jul 2008 17:04:52 -0400   author:   Arne Vajhøj

Re: RegEx Format Help   
Hi Arne,

Yes, the digits are the part I'm having the most trouble with.

Do I have to list each digit individually?

"Arne Vajhøj" wrote:

> jp2msft wrote:
> > Prior to now, my RegEx expression was as follows:
> > 
> > RegEx pattern = new Regex(@"[BCX][P057]\d{5} \d{4} \d{2}");
> > 
> > That has worked, but now I have been asked to enable the ability for our 
> > expressions to include an underscore ('_') at each of the character 
> > positions. (This is an SQL Query, and the underscore acts as a wildcard for 
> > individual characters)
> > 
> > Is there a nice way to modify my RegEx expression to include the underscore 
> > in a smart manner? (I'm not very good at creating RegEx expressions)
> 
> RegEx pattern = new Regex(@"[BCX_][P057_]\d{5} \d{4} \d{2}");
> 
> ?
> 
> Or do you want underscore support for the digits as well ?
> 
> Arne
>
date: Tue, 22 Jul 2008 15:12:02 -0700   author:   jp2msft

Re: RegEx Format Help   
jp2msft wrote:
> "Arne Vajhøj" wrote:
>> jp2msft wrote:
>>> Prior to now, my RegEx expression was as follows:
>>>
>>> RegEx pattern = new Regex(@"[BCX][P057]\d{5} \d{4} \d{2}");
>>>
>>> That has worked, but now I have been asked to enable the ability for our 
>>> expressions to include an underscore ('_') at each of the character 
>>> positions. (This is an SQL Query, and the underscore acts as a wildcard for 
>>> individual characters)
>>>
>>> Is there a nice way to modify my RegEx expression to include the underscore 
>>> in a smart manner? (I'm not very good at creating RegEx expressions)
>> RegEx pattern = new Regex(@"[BCX_][P057_]\d{5} \d{4} \d{2}");
>>
>> ?
>>
>> Or do you want underscore support for the digits as well ?
 > Yes, the digits are the part I'm having the most trouble with.
 >
 > Do I have to list each digit individually?

Just replace \d with [0-9_].

Arne
date: Tue, 22 Jul 2008 18:19:55 -0400   author:   Arne Vajhøj

Re: RegEx Format Help   
Works beautifully! Thank you, Sir!

"Arne Vajhøj" wrote:
> Just replace \d with [0-9_].
> 
> Arne
>
date: Wed, 23 Jul 2008 09:16:00 -0700   author:   jp2msft

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us