我需要能够将数据拉到不同的点
"test test <p>important information</p> test test test <p>more important information</p>"
结果应该是&#39;(&#34;重要&#34;&#34;信息&#34;&#34;更多&#34;&#34;重要&#34;&#34;信息&# 34)
答案 0 :(得分:2)
(define text "test test <p>important information</p> test test test <p>more important information</p>")
(append-map string-split
(regexp-match* #px"<p>([a-z ]+)</p>" text #:match-select cadr))
结果是: &#39;(&#34;重要&#34;&#34;信息&#34;&#34;更多&#34;&#34;重要&#34;&#34;信息&#34;)
答案 1 :(得分:0)
以下作品:
(define str "test test <p>important information</p> test test test <p>more important information</p>")
(set! str (string-replace str "<p>" "|"))
(set! str (string-replace str "</p>" "|"))
(string-split
(string-join
(for/list ((s (string-split str "|"))
(i (in-naturals)) #:when (odd? i))
s)))
输出:
'("important" "information" "more" "important" "information")