From 0e28399b120778e07bdd02921d42597e00648e5b Mon Sep 17 00:00:00 2001 From: shivers Date: Fri, 28 Mar 1997 20:55:23 +0000 Subject: [PATCH] Changed regexp-substring so that unmatched submatches return #f instead of raising an error. --- scsh/re.scm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/scsh/re.scm b/scsh/re.scm index 647800e..7a35080 100644 --- a/scsh/re.scm +++ b/scsh/re.scm @@ -26,12 +26,9 @@ (define (match:substring match . maybe-index) (let* ((i (:optional maybe-index 0)) (start (vector-ref (regexp-match:start match) i))) - (if start - (substring (regexp-match:string match) - start - (vector-ref (regexp-match:end match) i)) - (error match:substring "No sub-match found." match i)))) - + (and start (substring (regexp-match:string match) + start + (vector-ref (regexp-match:end match) i))))) ;;; Compiling regexps ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;