Home  >  Article  >  Backend Development  >  帮忙写个正则表达式解决思路

帮忙写个正则表达式解决思路

WBOY
WBOYOriginal
2016-06-13 10:46:11927browse

帮忙写个正则表达式


1、你如果今天(开心)我今天就不开心



2、你如果今天不(开心)我就开心



写一个正则表达式,匹配 2、你如果今天不(开心)我就开心 对应的 第一个包含它的p标签,注意p标签中可能有 align="center"等其它属相 也可能无,然后将它替换为空

谢谢各位了,小弟正则很菜

------解决方案--------------------
preg_replace('/]*?\/[pP]>/', '', $str);
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn