Modifiers change how the following expression should be treated.
let Modifier = ModifierKeyword BooleanSetting ';'; let ModifierKeyword = | 'enable' | 'disable'; let BooleanSetting = | 'lazy' | 'unicode';
enable lazy; disable unicode; [w]* ( disable lazy; .+ )
Modifiers are supported in all flavors.
Support for each mode is gated by the
ascii-mode features. Specify features with
Modes can be enabled and disabled in any scope.
There are two modifiers that can be enabled or disabled:
Enabling lazy mode means that all repetitions in the same scope are lazy by default; opting out
is done with the
greedy keyword, e.g.
enable lazy; [w]* greedy
Unicode mode is enabled by default. Disabling it means that the expression in the same scope
is no longer Unicode aware and assumes an ASCII-only input. As a result, shorthand character classes
are compiled differently (e.g.
[space] is compiled to
[ \t-\r]), and Unicode properties (e.g.
[Greek]) are unavailable. Non-ASCII strings and code points are still allowed.
> word boundaries.
Disabling Unicode can vastly improve runtime performance, especially for
Alternatively, you can use
[ascii_digit], and so on.
Modifiers produce no output, but they change how other expressions are compiled.
The dot and word boundaries are Unicode-aware in some regex engines even when Unicode mode is disabled.
Some mode modifiers are not yet implemented, most importantly
- Non-Unicode mode added in Pomsky 0.10
- Lazy mode added in Pomsky 0.3