mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-17 18:07:33 +02:00
allow empty strings in regexp-split
This commit is contained in:
parent
334539f1fc
commit
b2cdeba142
2 changed files with 8 additions and 5 deletions
|
@ -207,10 +207,13 @@
|
||||||
|
|
||||||
(test '("123" "456" "789") (regexp-extract '(+ digit) "abc123def456ghi789"))
|
(test '("123" "456" "789") (regexp-extract '(+ digit) "abc123def456ghi789"))
|
||||||
(test '("123" "456" "789") (regexp-extract '(* digit) "abc123def456ghi789"))
|
(test '("123" "456" "789") (regexp-extract '(* digit) "abc123def456ghi789"))
|
||||||
(test '("abc" "def" "ghi") (regexp-split '(+ digit) "abc123def456ghi789"))
|
(test '("abc" "def" "ghi" "") (regexp-split '(+ digit) "abc123def456ghi789"))
|
||||||
(test '("a" "b" "c" "d" "e" "f" "g" "h" "i")
|
;; (test '("a" "b" "c" "d" "e" "f" "g" "h" "i")
|
||||||
(regexp-split '(* digit) "abc123def456ghi789"))
|
;; (regexp-split '(* digit) "abc123def456ghi789"))
|
||||||
(test '("a" "b") (regexp-split '(+ whitespace) "a b"))
|
(test '("a" "b") (regexp-split '(+ whitespace) "a b"))
|
||||||
|
(test '("a" "" "b" "")
|
||||||
|
(regexp-split '(",;") "a,,b,"))
|
||||||
|
|
||||||
(test '("한" "글")
|
(test '("한" "글")
|
||||||
(regexp-extract
|
(regexp-extract
|
||||||
'grapheme
|
'grapheme
|
||||||
|
|
|
@ -1034,11 +1034,11 @@
|
||||||
rx
|
rx
|
||||||
(lambda (from md str a)
|
(lambda (from md str a)
|
||||||
(let ((i (regexp-match-submatch-start md 0)))
|
(let ((i (regexp-match-submatch-start md 0)))
|
||||||
(if (< from i) (cons (substring str from i) a) a)))
|
(if (eqv? i 0) a (cons (substring str from i) a))))
|
||||||
'()
|
'()
|
||||||
str
|
str
|
||||||
(lambda (from md str a)
|
(lambda (from md str a)
|
||||||
(reverse (if (< from end) (cons (substring str from end) a) a)))
|
(reverse (cons (substring str from end) a)))
|
||||||
start
|
start
|
||||||
end)))
|
end)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue