sdlyr8 Posted July 24, 2008 Share Posted July 24, 2008 Hey I'm writing a script that will convert a bunch of html documents and turn them into a wiki page. But some have <script>...</script> and <style>...</style> tags that I just need to get rid of. And I'm new with regular expressions so i don't know if i'm even doing it right. But it isn't working so can someone tell me what i'm doing wrong? Thanks a ton! $t = eregi_replace("<script(a-zA-Z0-9[:punct:][:space:])*</script>", "", $t); Link to comment https://forums.phpfreaks.com/topic/116484-reg-expression-help/ Share on other sites More sharing options...
effigy Posted July 25, 2008 Share Posted July 25, 2008 preg_replace('%<s(cript|tyle)[^>]*>.*?</s\1>%', '', $str); Link to comment https://forums.phpfreaks.com/topic/116484-reg-expression-help/#findComment-599489 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.