替换标签之间文本中的单词
我知道有很多类似的问题,但是没有我想要的,我需要替换标签之间的文字中的单词,但是问题是没有帐户空间或其他较差的问题,所以它不匹配,
我尝试添加以前添加逗号 /b,但行不通。
代码示例:
$content= preg_replace('@(?<=<p>)'.$value->data['target'].'(?=.*</p>)@', $value->data['string'], $content);
i know that there are many similar question but none have what im looking for, i need to replace a word from a text between tags but the problem is that is not having in account spaces or other wors so it doesnt match,
I tried adding before comma the /b but is not working.
Code Example:
$content= preg_replace('@(?<=<p>)'.$value->data['target'].'(?=.*</p>)@', $value->data['string'], $content);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试在标签之间找到文本并替换它。您可以尝试以下代码:
You can try to find the text between tags and replace it. You can try the following code: