|Did you know ...||Search Documentation:|
?- re_match("^needle"/i, "Needle in a haystack"). true.
Defined Options are given below. For details, see the PCRE
documentation. If an option is repeated, the first value is used
and subsequent values are ignored. Unrecognized options are
ignored. Unless otherwise specified, boolean options default to
If Regex is a text pattern (optionally with flags), then any of the Options for re_compile/3 can be used, in addition to the Options listed below. If Regex is the result of re_compile/3, then only the following execution-time Options are recognized and any others are ignored. Some options may not exist on your system, depending on the PCRE2 version and how it was built - these unsupported options are silently ignored.
start(From)Start at the given character index
true, match only at the first position
bol(Bool)String is the beginning of a line (default
true) - affects behavior of circumflex metacharacter (
empty(Bool)An empty string is a valid match (default
empty_atstart(Bool)An empty string at the start of the subject is a valid match (default
eol(Bool)String is the end of a line - affects behavior of dollar metacharacter (
any, recognize any Unicode newline sequence, if
anycrlf, recognize CR, LF, and CRLF as newline sequences, if
cr, recognize CR, if
lf, recognize LF, if
crlfrecognize CRLF as newline. The default is determined by how PCRE was built, and can be found by
newline2(Mode)- synonym for
utf_check(Bool)- see PCRE2 API documentation You should not need this because SWI-Prolog ensures that the UTF8 strings are valid, so the default is
endanchored(Bool)- see PCRE2 API documentation
partial_soft(Bool)- see PCRE2 API documentation
partial_hard(Bool)- see PCRE2 API documentation
dfa_restart(Bool)- see PCRE2 API documentation
dfa_shortest(Bool)- see PCRE2 API documentation
|Regex||- is the output of re_compile/3, a pattern or a term
Pattern/Flags, where Pattern is an atom or string. The defined flags
and their related option for re_compile/3 are below.
If Regex is the output of re_compile/3, any compile-time options in Options or Flags are ignored and only match-time options are used.
The options that are derived from flags take precedence over the
options in the Options list. In the case of conflicting flags, the
first one is used (e.g.,