Using Regular Expressions Metacharacters with .net – Comments and Mode Modifiers
With many flavors, the regex modes and match modes described earlier can be modified within the regex by the following constructs.
Mode modifier: (?modifier), such as (?i) or (?-i)
Many flavors now allow some of the regex and match modes to be set within the regular expression itself. A common example is the special notation (?i), which turns on case-insensitive matching, and (?-i), which turns it off. For example, <B>(?i)very(?-i)</B> has the very part match with case insensitivity, while still keeping the tag names case-sensitive. This matches ‘<B>VERY</B>’ and ‘<B>Very</B>’, for example, but not ‘<b>Very</b>’.
This example works with most systems that support (?i), including Perl, PHP, java.util.regex, Ruby,[] and the .NET languages. It doesn’t work with Python or Tcl, neither of which support (?-i).




