473,325 Members | 2,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

regex options

how do you set multiple options on a regular expresion ?

I have the following code, and I would like to have both run w/ the compiled option, but the (Optioni==TRUE) version needs to ingore case. is there a way to do this ?
if (Optioni)
{
RegexPattern[i]=new Regex(Pattern[i],RegexOptions.IgnoreCase);
}
else
{
RegexPattern[i]=new Regex(Pattern[i],RegexOptions.Compiled);
}
Nov 16 '05 #1
2 4099
RegexPattern[i]=new Regex(Pattern[i],RegexOptions.IgnoreCase |
RegexOptions.Compiled);

"Bas Hamer" <Ba******@discussions.microsoft.com> wrote in message
news:67**********************************@microsof t.com...
how do you set multiple options on a regular expresion ?

I have the following code, and I would like to have both run w/ the compiled option, but the (Optioni==TRUE) version needs to ingore case. is
there a way to do this ?

if (Optioni)
{
RegexPattern[i]=new Regex(Pattern[i],RegexOptions.IgnoreCase);
}
else
{
RegexPattern[i]=new Regex(Pattern[i],RegexOptions.Compiled);
}

Nov 16 '05 #2
RegexPattern[i]=new Regex(Pattern[i],RegexOptions.IgnoreCase |
RegexOptions.Compiled);

"Bas Hamer" <Ba******@discussions.microsoft.com> wrote in message
news:67**********************************@microsof t.com...
how do you set multiple options on a regular expresion ?

I have the following code, and I would like to have both run w/ the compiled option, but the (Optioni==TRUE) version needs to ingore case. is
there a way to do this ?

if (Optioni)
{
RegexPattern[i]=new Regex(Pattern[i],RegexOptions.IgnoreCase);
}
else
{
RegexPattern[i]=new Regex(Pattern[i],RegexOptions.Compiled);
}

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: kevin | last post by:
I am trying to strip the outermost html tag by capturing this tag with regex and then using the string replace function to replace it with an empty string. while stepping through the code, RegEx...
2
by: Jeff Jarrell | last post by:
I want to use the regex.replace for a string containing "%s" I can't seem to get the "%s" escaped. I tried a normal "\%s" but that doesn't seem to do it. Picks up any "s"....
5
by: Chris | last post by:
How Do I use the following auto-generated code from The Regulator? '------------------------------------------------------------------------------ ' <autogenerated> ' This code was generated...
4
by: Chris | last post by:
Hi Everyone, I am using a regex to check for a string. When all the file contains is my test string the regex returns a match, but when I embed the test string in the middle of a text file a...
7
by: Jordi Rico | last post by:
Hi, I know I can split a string into an array doing this: Dim s As String()=Regex.Split("One-Two-Three","-") So I would have: s(0)="One" s(1)="Two"
3
by: Pascal | last post by:
bonjour hello I would like to trim a string of all its white spaces so i used myString.trim() but it doesn't work as supposed : unsecable space are remaining in the middle of my string... i...
6
by: sloan | last post by:
I have a fairly simple RegEx code below. I am given a file name, (which I don't control) , and need to change a folder name in it. The code below is choking on the filename not being...
2
by: Mick Walker | last post by:
Hi All, I would like to know how I can limit users to only registering usernames which have alphanumberic characters and one underscore. From what I understand is I can use a regex to do this....
2
by: GS | last post by:
How can one avoid capturing leading empty or blank lines? the data I deal with look like this "will be paid on the dates you specified. xyz supplier amount: $100.52 when: September 07,...
2
by: John B | last post by:
I am trying to do a pretty simple pattern match using regex. The pattern is ^(?:(?<Item>.*?)@:@)*$. This should return a match for test123@:@ but does not, instead it never returns when I call...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.