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); Quote Link to comment 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); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.