RegExpr.ModifierStr property to turn on and off modifiers applied to the regular expressions. The following modifiers are available:
|Modifier key||Default state||Description|
|i||Enabled||Makes the pattern match case-insensitive.|
|m||Disabled||Treats string as multiple lines. In this mode, the caret ^ and dollar $ match before and after newlines in the subject string. See also Line separators .|
|s||Enabled||Treats string as single lines. In this mode, the dot matches new lines. See also Line separators.|
Controls greedy mode. Non-standard modifier.
"Greedy" repetition operator takes as many matching characters as possible, "non-greedy" takes as few as possible. For example, b+ and b* applied to string abbbbc will return bbbb, where as b+? will return b and b*? will return an empty string.
Switching into non-greedy mode makes + work as +?, * as *? and so on.
Permits whitespaces and comments in the pattern. Non-standard modifier.
In this mode, the whitespaces (\s) that are neither backslashed nor within a character class are ignored. You can use this to break up your regular expression into more readable parts. Also the # character is treated as a metacharacter introducing a comment. For example:
If you want to place a whitespace or # characters in the pattern, then you have to prefix them with / or encode them using hex notations (\xNN).
|RegExprObj||An expression, variable or parameter that specifies a reference to a RegExpr object|
The property is applied to the following object:
The string that contains any combination of modifier keys.
If a modifier key is prefixed with the minus sign the modifier turns off. For example,
ModifierStr := 'ig-s' enables case-insensitive matching and greedy mode and disables single-line mode.
To apply modifiers inside a regular expression or to a part of the regular expression specify a modifier keys within the (? ) structure. For example, expression (?i)te(?-i)st should match test and TEst, but not teST or TEST.
If you try to specify unsupported modifier keys an error occurs.
The following example specifies a regular expression’s modifier to make the pattern case-insensitive and to enable the multiline mode. It finds the first words in all the lines that start with “l” or “L”.