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.
怎么会有这样的东西:
<b><a class='visit' href='LINK'>LINK'S NAME</a></b>
可以变成这样:
<tr><td>LINK'S NAME<а href="LINK">constant text</a></td></tr>
除非您有充分的理由这样做,否则您永远不应该将正则表达式用于 HTML 操作。
匹配的正则表达式:
/<b>\s*<a\s+class='visit'\s+href='([^']*)'\s*>([^<]+)<\/a>\s*<\/b>/
替换网:
"<tr><td>$2<а href=\"$1\">constant text</a></td></tr>"