Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- preg_replace regex
August 26, 2004, 8:02 pm
rate this thread
- Janwillem Borleffs
August 27, 2004, 2:52 am
Re: preg_replace regex
Do you really mean 'between'?
[ ... ]
That's the right idea, but a step too far. Remember that
PCRE_UNGREEDY inverts greediness; the plus sign in your
pattern isn't greedy, so the dot stops matching at the first
'--->'. All '<---Message Start--->' and '<---Message End--
->' tags are removed.
You want it to stop after the last '--->' of the final '<---
Message End--->'. The quantifier should be greedy; e.g.,
`<---Message Start--->.*<---Message End--->`s