Skip to content

Regex options

Alexander Chernyshev edited this page May 10, 2022 · 3 revisions

RegEx options define RegEx parser behavior. Options can be used either in template via RO attribute or via inline options (for filtering in GUI for example).

OTLoV uses IgnoreCase by default everywhere. If you need case sensitivity for the rule either use RO="0" (or other value with no IgnoreCase) or see inline options below.

RegEx inline options

Inline RegEx options are supported. It can be used to override part of pattern behavior. The syntax is:

...(?imnsx-imnsx)...

Where:

  • ... - omited part of pattern,
  • ?imnsx - enabled flags,
  • -imnsx - disabled flags.

For example, if you want case-sensitive pattern to match exactly dOgS you can use:

(?-i)dOgS

See table below with all options.

RegEx options

Allows to set RegEx parsing options. If you are using RO attribute - sum up individual values to get the final value.

Value Name Inline Meaning
0 None Use default behavior.
1 IgnoreCase i Use case-insensitive matching.
2 Multiline m Use multiline mode, where ^ and $ match the beginning and end of each line (instead of the beginning and end of the input string).
4 ExplicitCapture n Do not capture unnamed groups. The only valid captures are explicitly named or numbered groups of the form (?<name>subexpression).
8 Compiled Not used in OTLoV - patterns are already precompiled.
16 Singleline s Use single-line mode, where the period . matches every character (instead of every character except \n).
32 IgnorePatternWhitespace x Exclude unescaped white space from the pattern, and enable comments after a number sign #.
64 RightToLeft Change the search direction. Search moves from right to left instead of from left to right.
256 ECMAScript Enable ECMAScript-compliant behavior for the expression.
512 CultureInvariant Ignore cultural differences in language.

English Русский

End-user

Templates development

Clone this wiki locally