> I have a question though. I am new to regular expressions, and I am
> confused as to what the "(?i" Stands for?
>> <snip>The initial sequence is a modifier indicating
>> that the regular expression is case-insensitive.
I prefer not to use Regex Options in my programming code. As I re-use
Regular Expressions, I don't want to have to remember what options to turn
on. Since the Regular Expressions syntax contains modifiers that supply
these options, I use them in the expressions.
> It would not compile while I kept the grouping <word> in the
> expression. I removed it, and it worked. How could I modify it, so it
(?i)(?:\s*OR\s*)?"([^"]*)"
On closer examination, I determined that my original was not robust enough.
The above should work well for you. Here's the explanation:
(?:\s*OR\s*)?
The word "OR" may precede the rest of the match, but is optional (may appear
0 or 1 times), and may have 0 or more spaces before and after it. It is in a
non-capturing group with the quantifier '?' indicating 0 or 1 times.
"([^"]*)
This is a capturing group (I removed the label, which would make it a named
capturing group). It indicates a quote character followed by 0 or more
non-quote characters, followed by a quote character. This way, there may be
any characters between the quotes.

Signature
HTH,
Kevin Spencer
Microsoft MVP
Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
>> (?i)(?:\s*OR\s*)?"(?<word>\w+)"
>>
>> This captures any sequence of word characters (digits or letters)
>> enclosed
<snip>
> I have a question though. I am new to regular expressions, and I am
> confused as to what the "(?i" Stands for?
[quoted text clipped - 12 lines]
> Regex regex = new Regex(@" (?i?\s)(?:\s*OR\s*)?""");
> passed = regex.IsMatch(TestData);
guate911 - 06 Jun 2007 17:00 GMT
> > I have a question though. I am new to regular expressions, and I am
> > confused as to what the "(?i" Stands for?
[quoted text clipped - 60 lines]
>
> - Show quoted text -
Thanks for the help