我有一个'a'标签的文本。我必须添加一些新的标签和属性。正则表达式的链接
它看起来像这样:
'Some test <a href="site">here</a>. Yet <a href="site2">another</a> test.'
现在我得:
'Some test <noindex><a rel="nofollow" href="site">here</a></noindex>.'
'Yet <noindex><a rel="nofollow" href="site2">another</a></noindex> test.'
任何快速的方法来做到这一点用PHP?谢谢。
无法解析[X] HTML与正则表达式。但是你可以用正确的结构化标记替代PHP中的正则表达式。这是一个有效的问题。 –