regex(re, str)
regex(re, start, str)
regex(re, start, range, str)
The value returned is a list of pairs of integers corresponding to the parenthesized subexpressions successfully matched, suitable for use as the first argument of substring. The first member of each pair is the offset within str of the substring matched, and the second is the length.
See regular expressions for a brief introduction to the topic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
By default, the regular expressions are interpreted using the Perl flavor, which supports features such as lookaheads and lookbehinds for fine-tuning the matches. This syntax is used in Perl and JavaScript languages.
|
|
Alternatively, one can choose the POSIX Extended flavor of regex using POSIX => true. This syntax is similar to the one used by the Unix utilities egrep and awk and enforces the leftmost, longest rule for finding matches. If there's a tie, the rule is applied to the first subexpression.
|
|
|
In the Perl flavor, one can specify whether repetitions should be possessive or non-greedy.
|
|
The object regex is a method function with options.