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... Link to comment https://forums.phpfreaks.com/topic/262711-a-problem-with-regex/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.