izeid Posted May 18, 2012 Share Posted May 18, 2012 I'm trying to clean up web pages before loading them into iframe using PHP and AJAX . I'm trying to capture Any alert(anything can be here); promt(anything can be here); and window.location Javascript codes From HTML and .js Files bye using Below Regular Expression. preg_replace('#^(?<alert>)(.*?)[;$]#'," ",$webpage); it works fine only if alert(anything can be here);command exist in a line only but if there were any extra codes before this code in a same line , whole the line would be replaced with blank Space either. this is what i don't want to happen. I want Exact Part Of Code in Any Where even if there is any number of alert(anything can be here); commands is a same line , I want them to be selected separately. would you please help me whit that .... thank you... 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.