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

re-case

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:

If no clause match, nil is returned.

See also re-let 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.