'What does (?i) in a .NET regular expression mean?

In our code there is a regular expression of the following form:

string regex = @"(?i)foo=(BAR?-[A-Z]+(33|34)?)";

What does the "(?i)" at the beginning of the regex match/do? I've looked through the .NET regex documentation and can't seem to figure out what (?i) would mean. Thanks!



Solution 1:[1]

(?i) means: Ignore case option enabled. It's equivalent to call Regex.Matches with 3rd param RegexOptions.IgnoreCase

Solution 2:[2]

It sets regex to ignore the case. In the future you can use Expresso to figure things like this out:enter image description here

Solution 3:[3]

(?i) turns on case insensitivity. So its a case insensitive match.

Solution 4:[4]

Turns on ignore case within the enclosing group

Solution 5:[5]

It means ignore case for remainder, not for whole pattern! [A-Z](?i)[a-z]+ will match aaaaaaaAAAAAAAAbbbbbbb

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kirill Polishchuk
Solution 2 Yuriy Faktorovich
Solution 3 jaywayco
Solution 4 Bob Vale
Solution 5 Peter Csala