简体   繁体   English

帮助PHP中需要RegEx

[英]Help with RegEx needed in PHP

I have this kind of strings... 我有这种字符串......

---Quote (Originally by cyberpig)---
I thought is use hair dryer on the GPU? Put whole card in oven PCB won't melt meh?
---End Quote---
back in my old company, when we do such troubleshooting we usually use a blower/dryer meant for pcb components.

from those, I want to strip out all the text between ---Quote and Quote--- , including them. 从那些,我想删除---QuoteQuote---之间的所有文本,包括它们。 Kindly provide a PHP function please. 请提供PHP功能。

Thx 谢谢

Try this: 尝试这个:

$newText = preg_replace('/---Quote.*?---.*?---End Quote---/s', '', $oldText);

Tested on RegexPal . RegexPal上测试

Try this one: 试试这个:

preg_replace("#---Quote(.|\n)*Quote---#m", "", $str);

ReFiddle here. 在这里重新说明。

preg_replace('/-{3}Quote(?:.\n)*-{3}End Quote-{3}/', '', $str);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM