How to control the overal mode of a regular expression.
This page describes how to control the overal mode of a regular expression.
N.B. - All of the modes operate relative to a specific group. For details of options see the page on Groups. The default scope for mode specifiers is the, entire regular expression. The mode change takes place at the beginning the group no matter where the mode specifier is placed within the group. This remains true for the root group, i.e. the group for which there is no parenthesis. Other options are available.
Ways to specify the expression mode
Enable case insensitivity.
Disable case insensitivity.
Enable "dot matches newline".
Disable "dot matches newline".
Enable "dollar and caret on line ends".
Disabel "dollar and caret on line ends".
Mode specifiers can be concatenated, this enables "i" and disables "s" and "m".
Modes can be localised, in this case the expression text is parsed with "i" enabled and "s" and "m" disabled. The parent of this group would operate in the default mode, or whichever mode had otherwis been specified for it previously.