fixed rx: submatches now contain bos/eos

This commit is contained in:
jottbee 2005-02-26 08:48:02 +00:00
parent 68a122a2a5
commit 92821d9337
1 changed files with 6 additions and 6 deletions

View File

@ -100,12 +100,12 @@
(middle (list-ref submatches 1)) (middle (list-ref submatches 1))
(right (list-ref submatches 2)) (right (list-ref submatches 2))
(constructed-rx (if (and (string? middle) (string=? "%" middle)) (constructed-rx (if (and (string? middle) (string=? "%" middle))
(rx (: (submatch ,left) (rx (: (submatch (: bos ,left))
(submatch (* any)) (submatch (* any))
(submatch ,right))) (submatch (: ,right eos))))
(rx (: (submatch ,left) (rx (: (submatch (: bos ,left))
(submatch ,middle) (submatch ,middle)
(submatch ,right))))) (submatch (: ,right eos))))))
(maybe-match (regexp-search constructed-rx target-name))) (maybe-match (regexp-search constructed-rx target-name)))
(if maybe-match (if maybe-match
(map (lambda (match-no) (map (lambda (match-no)
@ -120,9 +120,9 @@
(define (get-submatches-percent target-descr) (define (get-submatches-percent target-descr)
(map (lambda (match-no) (map (lambda (match-no)
(match:substring (regexp-search (rx (: (submatch (* any)) (match:substring (regexp-search (rx (: (submatch (: bos (* any)))
(submatch "%") (submatch "%")
(submatch (* any)))) (submatch (: (* any) eos))))
target-descr) target-descr)
match-no)) match-no))
(list 1 2 3))) (list 1 2 3)))