i'm using PHP and i want to check the following tags: iframe and script
I want that if they contains X value in the src attribute to add a Y class to the tag and change src attribute name to data-src.
ex.
$blacklist = array("google.com/plus.js", "google.com/drive.js");
$myclass = "blocked";
$html = '<script src="http://google.com/plus.js"></script>';
foreach($blacklist as $black)
{
$html = preg_replace(...);
}
/* now $html must be: "<script data-src="google.com/plus.js" class="blocked"></script> */
Anyone can help me with this Regex operation?