mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 06:41:13 +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.
|
||||
(let next-match ((matches (list-matches regexp string))
|
||||
(start 0))
|
||||
(if (pair? matches)
|
||||
(if (null? matches)
|
||||
(display (make-shared-substring string start) port)
|
||||
(let ((m (car matches)))
|
||||
|
||||
;; Process all of the items for this match. Don't use
|
||||
|
@ -184,11 +185,7 @@
|
|||
(make-shared-substring string start (match:start m))
|
||||
port))
|
||||
((eq? item 'post)
|
||||
(if (pair? (cdr matches))
|
||||
(next-match (cdr matches) (match:end m))
|
||||
(display
|
||||
(make-shared-substring string (match:end m))
|
||||
port)))
|
||||
(next-match (cdr matches) (match:end m)))
|
||||
(else (error 'wrong-type-arg item))))
|
||||
|
||||
(if (pair? items)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue