正则表达式捕获最后一个
标记并用一些文本替换它我想捕捉决赛
tag in a string. Here's what I came up with: /(</p>)$/
这是否会在如下所示的典型 html 脚本中引起任何问题:
<p>Copyright 2010 ©</p>
<p>Sanscode</p>
它似乎工作正常,但由于我是正则表达式的新手,我想知道是否有人有任何警告或需要我注意的事情。我正在使用 preg_replace()。
谢谢
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 ©</p>
<p>Sanscode</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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果最后一个尖括号后面有空格字符,它将不匹配。
It would not match, if there are whitespace characters behind the last angel bracket.