Regular expression functionality in Qore is provided by PCRE: Perl-Compatible Regular Expression library.
Using this library, Qore implements regular expression pattern matching using the same syntax and semantics as Perl 5.
The following is a list of operators based on regular expressions (or similar to regular expressions in the case of the transliteration operator).
Table 2.83. Regular Expression Operators
Operator | Description |
---|---|
Returns True if the regular expression matches a string. | |
Returns True if the regular expression does not match a string. | |
Substitutes text in a string based on matching a regular expression. | |
Returns a list of substrings in a string based on matching patterns defined by a regular expression. | |
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.
Table 2.84. Regular Expression Options
Option | Description |
---|---|
i | Ignores case when matching |
m | makes start-of-line (^) or end-of-line ($) match after or before any newline in the subject string |
s | makes a dot (.) match a newline character |
x | ignores whitespace characters and enables comments prefixed by # |
g | makes global substitutions (only applicable with the substitution operator) |
The following is a list of functions providing regular expression functionality where the pattern may be given at run-time:
Table 2.85. Regular Expression Functions
Function | Description |
---|---|
Returns True if the regular expression matches a string. | |
Substitutes a pattern in a string based on regular expressions and returns the new string. | |
Returns a list of substrings in a string based on matching patterns defined by a regular expression. |