A Monoid representing nearly every facility PCRE2 presents for tweaking the behavior of regex compilation and execution.
All library functions that take options have the suffix Opt in their names;
for each of them, there's also a non-Opt convenience function that simply
has the (unexported) mempty option. For many uses, options won't be
needed.
Some options can be enabled by special character sequences in the pattern as an alternative to specifying them as an Option. See Caseless for example.
Most options are exported in Text.Regex.Pcre2. The callout interface is found in Text.Regex.Pcre2.Unsafe.
Documentation is scant here. For more complete, accurate information, including discussions of corner cases arising from specific combinations of options and pattern items, please see the C API documentation.
Constructors
BadEscapeIsLiteralDo not throw an error for unrecognized or malformed escapes. "This is a dangerous option."
UnsafeCompileRecGuard (Int -> IO Bool)Run the given guard on every new descent into a level of parentheses, passing the current depth as argument. Returning
Falseaborts pattern compilation with an exception. Multiples of this option before the rightmost are ignored.NOTE: Currently (PCRE2 version 10.39) patterns seem to be compiled in two passes, both times triggering the recursion guard. Also, it is triggered at the beginning of the pattern, passing 0. None of this is documented; expect the unexpected in the presence of side effects!
UnsafeCallout (CalloutInfo -> IO CalloutResult)Run the given callout at every callout point (see the docs for more info). Multiples of this option before the rightmost are ignored.
AutoCalloutRun callout for every pattern item. Only relevant if a callout is set.
UnsafeSubCallout (SubCalloutInfo -> IO SubCalloutResult)Run the given callout on every substitution. This is at most once unless SubGlobal is set. Multiples of this option before the rightmost are ignored.