开发者

Regular Expression to capture the last </p> tag and replace it with some text

I want to capture the final

tag in a string. Here's what I came up with:

 /(</p>)$/

Is this going to cause any problems in a typical html script that looks like this:

<p>Copyright 2010 &copy;</p>
<p>Sanscode开发者_JAVA技巧</p>

It seems to work fine, but since i'm new to regex I was wondering if anyone had any caveats or things for me to note. I am using preg_replace().

Thanks


It would not match, if there are whitespace characters behind the last angel bracket.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜