帮助PHP中需要RegEx

时间:2011-04-14 01:00:43

标签: php regex string

我有这种字符串......

---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.

从那些,我想删除---QuoteQuote---之间的所有文字,包括它们。 请提供PHP函数。

THX

3 个答案:

答案 0 :(得分:2)

试试这个:

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

RegexPal上进行了测试。

答案 1 :(得分:0)

试试这个:

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

ReFiddle here.

答案 2 :(得分:0)

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