Next: Splitting and Replacing, Previous: CL-PPCRE Basic Operations, Up: CL-Portable Perl-compatible Regular Expressions—CL-PPCRE [Contents][Index]
The function accepts most of the regex syntax of Perl 5.8 as described in man
perlre
including extended features like non-greedy repetitions, positive and
negative look-ahead and look-behind assertions, "standalone" subexpressions,
and conditional subpatterns.
The following Perl features are currently supported:
The following Perl features are (currently) not supported:
(?{ code })
and (??{ code })
because they obviously don’t make sense in
Lisp.
pos()
because we don’t have it.
scanner, register-names
Accepts a string which is a regular expression in Perl syntax and returns a closure which will scan strings for this regular expression.
The second value is only returned if ‘*ALLOW-NAMED-REGISTERS*’ is ‘true’.
(return value) represents a list of strings mapping
registers to their respective names; the first element stands for first
register, the second element for second register, etc. You have to store this
value if you want to map a register number to its name later as scanner
doesn’t capture any information about register names. If a register isn’t
named, it has ‘NIL’ as its name.
The ‘mode’ keyword arguments are equivalent to the ‘imsx’ modifiers in Perl. The ‘destructive’ keyword will be ignored.
This is similar to CREATE-SCANNER
for regex strings above but accepts a
parse tree as its first argument. A parse tree is an S-expression conforming
to the following syntax:…
scanner, register-names
Searches the string target-string
from start
(which defaults to 0) to end
(which defaults to the length of target-string
) and tries to match regex
.
On success returns four values:
On failure returns ‘NIL’.
match, regs
Like SCAN
but returns substrings of target-string
instead of positions,
i.e. this function returns two values on success:
sharedp
is true, the substrings may share structure with
target-string
.