(define (repl-substring? string target pos)
;; Returns true if the specified substring can be replaced
(let* ((could-match (<= (+ pos (string-length target))
(string-length string)))
(match (if could-match
(substring string pos (+ pos (string-length target))) "")))
(and could-match (string=? match target))))