Replace blocks wrapped in HTML comments
Posted: Thu Jan 17, 2008 11:02 pm
I have some HTML source like:
Here is the simple regex I have constructed thus far:
I can keep the regex simple and assume there is NO whitespace between the comments themselves...only the content inbetween START and FINISH may be subject to whitespace or anything else...which is why I'm confused why my regex doesn't work...even remotely. If I remove the proceeding '+' it matches nothing...if I add it...everything goes bye bye. 
Can someone please help correct my regex so I can continue with my project.
p.s-I'm using preg_replace
Cheers
Code: Select all
<!--[START]-->This is some HTML content which needs to be replaced dynamically...is it possible?<!--[FINISH]-->Code: Select all
$regex = '/<!--\[START\]-->(.|\s)+<--\[FINISH\]-->/';Can someone please help correct my regex so I can continue with my project.
p.s-I'm using preg_replace
Cheers