fixed rx: submatches now contain bos/eos
This commit is contained in:
parent
68a122a2a5
commit
92821d9337
|
@ -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)))
|
||||||
|
|
Loading…
Reference in New Issue