MacroPackage: exclToCDocOverviewCGDocRelNotesIndexPermutedIndex
Allegro CL version 7.0
This page is new in 7.0.

re-let

Arguments: regexp string bindings &body body

regexp and bindings are the same as of re-lambda. string must be an expression that evaluates to a string. This macro evaluates string, matches it with regexp, and if it matches, bind variables with (sub)matches according to bindings, then evaluates body. If string doesn't match regexp, body is not evaluated and nil is returned.

See also re-case and re-lambda.

Example

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.

ToCDocOverviewCGDocRelNotesIndexPermutedIndex
Allegro CL version 7.0
This page is new in 7.0.