There is also the possibility to enable Modifier only on a specific group, so that the Modifier doesn't stay valid until end or deactivation with "(?-<modifier>)".
The Syntax for that is "?<modifier>:" on the beginning of the group, i.e. (?i:foo) matches on FoO.