Gayner Posted August 31, 2009 Share Posted August 31, 2009 preg_replace .. Thanks for coming here.. But I need a preg_replace that removes anything that has <meta or any type of html Refresh/JAVASCRIPT so When I allow it for my users they can use it but only works with html attributes like font color/etc.. I know it's something like this: $stxt = str_replace("+", " ", $stxt); Now Help me please.. I googled and found no answers do came here Quote Link to comment https://forums.phpfreaks.com/topic/172534-preg_replace-replace-meta-fresh-only/ Share on other sites More sharing options...
ignace Posted August 31, 2009 Share Posted August 31, 2009 $txt = (array) preg_replace('/\<(meta|script).+\>/', '', $txt); Quote Link to comment https://forums.phpfreaks.com/topic/172534-preg_replace-replace-meta-fresh-only/#findComment-909653 Share on other sites More sharing options...
Gayner Posted August 31, 2009 Author Share Posted August 31, 2009 $txt = (array) preg_replace('/\<(meta|script).+\>/', '', $txt); Wow really? im about to try this.. thanks a bunch.. this will be epic our users will have alot of more free time to beable to use whatever they want do i have to have array? Quote Link to comment https://forums.phpfreaks.com/topic/172534-preg_replace-replace-meta-fresh-only/#findComment-909681 Share on other sites More sharing options...
Prismatic Posted August 31, 2009 Share Posted August 31, 2009 $txt = (array) preg_replace('/\<(meta|script).+\>/i', '', $txt); added i for case insensitive. Quote Link to comment https://forums.phpfreaks.com/topic/172534-preg_replace-replace-meta-fresh-only/#findComment-909722 Share on other sites More sharing options...
ignace Posted August 31, 2009 Share Posted August 31, 2009 $txt = (array) preg_replace('/\<(meta|script).+\>/', '', $txt); Wow really? im about to try this.. thanks a bunch.. this will be epic our users will have alot of more free time to beable to use whatever they want do i have to have array? No. Quote Link to comment https://forums.phpfreaks.com/topic/172534-preg_replace-replace-meta-fresh-only/#findComment-909731 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.