Moe Sweet
Moe Sweet

Reputation: 3721

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. Kindly provide a PHP function please.

Thx

Upvotes: 0

Views: 49

Answers (3)

Jimmy Sawczuk
Jimmy Sawczuk

Reputation: 13614

Try this one:

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

Upvotes: 0

alex
alex

Reputation: 490657

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

Upvotes: 0

Doug Paul
Doug Paul

Reputation: 1243

Try this:

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

Tested on RegexPal.

Upvotes: 2

Related Questions