Link to home
Start Free TrialLog in
Avatar of hankknight
hankknightFlag for Canada

asked on

Remove everything between <[% and %]>

I want to remove all instances of everything between <[% and %]>
Avatar of hielo
hielo
Flag of Wallis and Futuna image

try:
echo preg_replace( '#<\[%[^%]%\]>#','',$str );
Avatar of hankknight

ASKER

Thanks, hielo, but your idea does not work.
<?php
$str= 'Hello <[%edit%]> World <[%/edit%]>';
echo preg_replace( '#<\[%[^%]%\]>#','', $str);
// Should Output: Hello World
?>

Open in new window

SOLUTION
Avatar of ddrudik
ddrudik
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the question and the points.
glad to help