regexp-replace*: recognize \$
as empty string
This commit is contained in:
parent
d988055a49
commit
c9c03dd40b
|
@ -1121,6 +1121,8 @@
|
||||||
(test "x&cy&z" regexp-replace* #rx"a(.)" "xabcyawz" "\\&")
|
(test "x&cy&z" regexp-replace* #rx"a(.)" "xabcyawz" "\\&")
|
||||||
(test "x\\cy\\z" regexp-replace* #rx"a(.)" "xabcyawz" "\\\\")
|
(test "x\\cy\\z" regexp-replace* #rx"a(.)" "xabcyawz" "\\\\")
|
||||||
|
|
||||||
|
(test "ap0p0le" regexp-replace* #rx"p" "apple" "\\0\\$0")
|
||||||
|
|
||||||
;; Test sub-matches with procedure replace (second example by synx)
|
;; Test sub-matches with procedure replace (second example by synx)
|
||||||
(test "myCERVEZA myMI Mi"
|
(test "myCERVEZA myMI Mi"
|
||||||
regexp-replace* "([Mm])i ([a-zA-Z]*)" "mi cerveza Mi Mi Mi"
|
regexp-replace* "([Mm])i ([a-zA-Z]*)" "mi cerveza Mi Mi Mi"
|
||||||
|
|
|
@ -410,7 +410,9 @@
|
||||||
(or (and (equal? (char->integer #\&) next)
|
(or (and (equal? (char->integer #\&) next)
|
||||||
#"&")
|
#"&")
|
||||||
(and (equal? (char->integer #\\) next)
|
(and (equal? (char->integer #\\) next)
|
||||||
#"\\")))
|
#"\\")
|
||||||
|
(and (equal? (char->integer #\$) next)
|
||||||
|
#"")))
|
||||||
=> (lambda (s)
|
=> (lambda (s)
|
||||||
(cons s (loop (add1 (cdar m)))))]
|
(cons s (loop (add1 (cdar m)))))]
|
||||||
[else
|
[else
|
||||||
|
|
Loading…
Reference in New Issue
Block a user