preg replace - How to remove text with preg_replace function of php -
i have code this:
$data='<p>text begin</p> <script type="text/javascript"> $(".idr").hide(); $("[rel=tooltip]").tooltip({ placement: "top"}); </script> <p>text finish</p>';
i'm trying remove below text:
<script type="text/javascript"> $(".idr").hide(); $("[rel=tooltip]").tooltip({ placement: "top"}); </script>
with preg_replace()
echo preg_replace("/<script(.+?)script>/i", '', $data);
but it's doesn't work. suggestions?
if tring remove script try this:
preg_replace('/<script\b[^>]*>(.*?)<\/script>/is', "", $data);
Comments
Post a Comment