s_p
s_p

Reputation: 4693

regex everything in between html comments

i am trying to remove everything in between html comments <!-- REMOVE --> in php using regex. can anyone lend a hand please

$str = preg_replace('/\<!--.*\-->/', '', $str);

Upvotes: 0

Views: 1988

Answers (1)

Rob
Rob

Reputation: 12872

Try preg_replace('/<!--.*-->/sU', '', $str);

Upvotes: 1

Related Questions