0

我正在尝试删除所有看起来像这样的 html:

<p><font face="Arial" size="2"><a href="#top">Back to the top</a></font></p>

字体和大小各不相同,可能还有其他一些东西。

只是为了确保,我正在使用以下正则表达式:

/<p.*?><font.*?><a href=.*?>Back.*?<\/a><\/font><\/p>/is

但是,它匹配我正在搜索的完整文本字符串,例如:

<p>However, if this is our reaction, we will indeed be weak in our weaknesses. For the strength of Christ does not come to rest upon us in the midst of discontent and rebellion.</p> <p>Seeing the great design of the Lord in affliction, let us rather take pleasure in our afflictions. Let us glory, that is boast, in them, and in wisdom let us then turn to Jesus Christ our Savior to receive His great strength.</p> <p>Then in our weakness we will be indeed very strong!</p> <p><font face="Arial" size="2"><a href="#top">Back to the top</a></font></p> <hr> 

我究竟做错了什么?!?

4

1 回答 1

1

将点更改为 [^>]

/<p[^>]*?><font[^>]*?><a href=[^>]*?>Back[^>]*?<\/a><\/font><\/p>/is
于 2013-10-12T14:12:45.563 回答