Options for XRegExp Regular Expressions
Regular expressions can have options (also known as flags) that modify their behavior. Each engine supports a different set of options.
Option | Description | Backend value | Portable value |
---|
n | Named capture only | explicitcapture | (not portable) |
s | Dot matches all (singleline) | dotall | dotall |
x | Free-spacing and line comments (extended) | comment | comments |
A | 21-bit Unicode properties (astral) — Requires the Unicode Base addon | astral | (not portable) |
g | All matches, or advance lastIndex after matches (global) | global | (not portable) |
i | Case insensitive (ignoreCase) | ignorecase | ignorecase |
m | ^ and $ match at newlines (multiline) | multiline | multiline |
y | Matches must start at lastIndex (sticky) — Requires Firefox 3+ or native ES6 support | sticky | (not portable) |
XRegExp provides four new flags (n, s, x, A), which can be combined with native flags and arranged in any order. Unlike native flags, non-native flags do not show up as properties on regular expression objects.