mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-22 19:44:10 +02:00
* regex.scm (regexp-substitute/global): Handle the end of the
match list and an empty match list identically. (Thanks to Greg Badros.)
This commit is contained in:
parent
8cc9503dc0
commit
f564140129
1 changed files with 3 additions and 6 deletions
|
@ -166,7 +166,8 @@
|
||||||
;; Walk the set of non-overlapping, maximal matches.
|
;; Walk the set of non-overlapping, maximal matches.
|
||||||
(let next-match ((matches (list-matches regexp string))
|
(let next-match ((matches (list-matches regexp string))
|
||||||
(start 0))
|
(start 0))
|
||||||
(if (pair? matches)
|
(if (null? matches)
|
||||||
|
(display (make-shared-substring string start) port)
|
||||||
(let ((m (car matches)))
|
(let ((m (car matches)))
|
||||||
|
|
||||||
;; Process all of the items for this match. Don't use
|
;; Process all of the items for this match. Don't use
|
||||||
|
@ -184,11 +185,7 @@
|
||||||
(make-shared-substring string start (match:start m))
|
(make-shared-substring string start (match:start m))
|
||||||
port))
|
port))
|
||||||
((eq? item 'post)
|
((eq? item 'post)
|
||||||
(if (pair? (cdr matches))
|
(next-match (cdr matches) (match:end m)))
|
||||||
(next-match (cdr matches) (match:end m))
|
|
||||||
(display
|
|
||||||
(make-shared-substring string (match:end m))
|
|
||||||
port)))
|
|
||||||
(else (error 'wrong-type-arg item))))
|
(else (error 'wrong-type-arg item))))
|
||||||
|
|
||||||
(if (pair? items)
|
(if (pair? items)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue