| Allegro CL version 7.0 This page is new in 7.0. | |||||||||
Arguments: string &rest clauses
string must be an expression that evaluates to a string. The clauses are then examined one by one, checking whether it matches string or not. clauses must be one of the following forms:
regexp,
(sub)matches are bound to the variables according to
bindings, then expr
... are evaluated. See the documentation of re-lambda for information on the
specifiction of regexp and
bindings.
(:test proc expr ...):
proc must be an expression that evaluates to
a procedure that takes single argument. proc
is called with string, and if it returns a true
value, evaluates expr ....
(:testlet proc var expr ...): like
:test above, but binds the result of
proc to var while
evaluating expr....
(t expr ...): always match and evaluates
expr .... This can be used to describe the
fallback case.
If no clause match, nil is returned.
See also re-let and re-lambda.
cl-user(4): (setq f
(re-lambda "([^ ]+) ([^ ]+) ([^ ]+)"
((foo 1) (bar 2) (baz 3))
(list foo bar baz)))
#<Interpreted Function (unnamed) @ #x71ed7892>
cl-user(5): (funcall f "foo the bar")
("foo" "the" "bar")
cl-user(6): (re-let "([^ ]+) ([^ ]+) ([^ ]+)"
"foo the bar"
((foo 1) (bar 2) (baz 3))
(list foo bar baz))
("foo" "the" "bar")
cl-user(7):
cl-user(9): (re-case "foo the barmy"
("foo a (.*)" ((it 1)) (list it))
("foo the (.*)" ((it 1)) (list it))
(t :no-match))
("barmy")
cl-user(10): (re-case "foo a barmy"
("foo a (.*)" ((it 1)) (list it))
("foo the (.*)" ((it 1)) (list it))
(t :no-match))
("barmy")
cl-user(11): (re-case "foo xx barmy"
("foo a (.*)" ((it 1)) (list it))
("foo the (.*)" ((it 1)) (list it))
(t :no-match))
:no-match
cl-user(12):
The actual home package of this symbol is the regexp package. It is also exported from (and documented with) the excl package.
See The new regexp2 module in regexp.htm for fuether information on this macro and the regexp2 module.
Copyright (c) 1998-2006, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 7.0. This page is new in the 7.0 release.
Created 2005.9.20.
| Allegro CL version 7.0 This page is new in 7.0. | |||||||||