Changed regexp-substring so that unmatched submatches return #f instead of
raising an error.
This commit is contained in:
parent
5e85d401b9
commit
0e28399b12
|
@ -26,12 +26,9 @@
|
||||||
(define (match:substring match . maybe-index)
|
(define (match:substring match . maybe-index)
|
||||||
(let* ((i (:optional maybe-index 0))
|
(let* ((i (:optional maybe-index 0))
|
||||||
(start (vector-ref (regexp-match:start match) i)))
|
(start (vector-ref (regexp-match:start match) i)))
|
||||||
(if start
|
(and start (substring (regexp-match:string match)
|
||||||
(substring (regexp-match:string match)
|
start
|
||||||
start
|
(vector-ref (regexp-match:end match) i)))))
|
||||||
(vector-ref (regexp-match:end match) i))
|
|
||||||
(error match:substring "No sub-match found." match i))))
|
|
||||||
|
|
||||||
|
|
||||||
;;; Compiling regexps
|
;;; Compiling regexps
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
Loading…
Reference in New Issue