473,405 Members | 2,167 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,405 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 4103
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.