I have this regex expression:
$str = preg_replace_callback('@((https?://)?([-\w]+\.[-\w\.]+)+\w(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)*)@', function
($matches){return en($matches[1]);}, $str);
Against this html code:
<iframe src="//example.com/hello.php"></iframe>
the output is:
<iframe src="//maskedurl.php?l=kdsdhkhdkshdkhsdskhd"></iframe>
How can i have the regex not output the 2 slashes, // ? and have it only display:
<iframe src="maskedurl.php?l=kdsdhkhdkshdkhsdskhd"></iframe>
yes I know it's missing the http: but that is out of my control
//is being grouped, which you don't want. Alternatively: return asubstrfrom within the callback (iesubstr($matches[1], 2))