Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Groovy 中使用正则表达式捕获链接的 href 值的最佳方法是什么?
example: <a href="http://someurl.com">some link</a>
example: <a href="
">some link</a>
我想捕捉粗体字。
这取决于您从中挑选锚标签的内容,但是如果您将其与所显示的内容隔离开来,则以下内容应该可以工作:
def link= """<a href="http://someurl.com">some "link</a>""" def url = (x =~ /\"(.*?)\"/)[0][1]