chickadee » regex » grep

grep REGEX LIST #!optional ACCESSORprocedure

Returns all items of LIST that match the regular expression REGEX. This procedure could be defined as follows:

(define (grep regex lst)
  (filter (lambda (x) (string-search regex x)) lst) )

ACCESSOR is an optional accessor-procedure applied to each element before doing the match. It should take a single argument and return a string that will then be used in the regular expression matching. ACCESSOR defaults to the identity function.