Changed regexp-substring so that unmatched submatches return #f instead of

raising an error.
This commit is contained in:
shivers 1997-03-28 20:55:23 +00:00
parent 5e85d401b9
commit 0e28399b12
1 changed files with 3 additions and 6 deletions

View File

@ -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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;