Qore Programming Language Reference Manual 0.8.12.8
Regular expression functionality in Qore is provided by PCRE: Perl-Compatible Regular Expression library.
Using this library, Qore implements regular expression pattern matching using very simple syntax with semantics similar to those of Perl 5. One difference between Qore and Perl to keep in mind is that backreferences in Qore are referenced as
$3, etc which differs from Perl's syntax (which uses numbered backslashes instead).
The following is a list of operators based on regular expressions (or similar to regular expressions in the case of the transliteration operator).
Regular Expression Operators
|Regular Expression Match Operator (=~)||Returns True if the regular expression matches a string|
|Regular Expression No Match Operator (!~)||Returns True if the regular expression does not match a string|
|Regular Expression Substitution Operator||Substitutes text in a string based on matching a regular expression|
|Regular Expression Pattern Extraction Operator||Returns a list of substrings in a string based on matching patterns defined by a regular expression|
|Transliteration Operator||Not a regular expression operator; transliterates one or more characters to other characters in a string|
See the table below for valid regular expression options.
Regular Expression Options
|Ignores case when matching|
|makes start-of-line (|
|makes a dot (|
|ignores whitespace characters and enables comments prefixed by |
|makes global substitutions or global extractions (only applicable with the substitution and extraction operators)|
The following is a list of functions providing regular expression functionality where the pattern may be given at run-time:
Regular Expression Functions
|regex()||Returns True if the regular expression matches a string|
|regex_subst()||Substitutes a pattern in a string based on regular expressions and returns the new string|
|regex_extract()||Returns a list of substrings in a string based on matching patterns defined by a regular expression|
$num for backreferences in regular expression substitution expressions. The first backreference is
$1, the second $2, and so on.