我想尝试在跨度标签之间匹配字符串的内部部分,以保证该跨度标签的 id 以 blk 开头。
我怎样才能将它与 groovy 匹配?
例子 :
<p>I wanted to try to <span id="blk1">match</span> the inner part of the string<span id="blk2"> between </span>the span tags <span>where</span> it is guaranteed that the id of this span tags <span id="blk3">starts</span> with blk.</p>
根据上面的例子,我想要
match
between
starts
我尝试了以下,但它返回 null;
def html='''<p>I wanted to try to <span id="blk1">match</span> the inner part of the string<span id="blk2"> between </span>the span tags <span>where</span> it is guaranteed that the id of this span tags <span id="blk3">starts</span> with blk.</p>'''
html=html.findAll(/<span id="blk(.)*">(.)*<\/span>/).join();
println html;