$re = '/(?=[a-zA-Z0-9\/ \.\-]+\/\/:ptth) \./m';
$str = 'nospmiS maC retroper lanruoJ teertS llaW edulcni repapswen eht fo inmula elbatoN lmths .7665401-09.snruT .sweN-ehT/sweN/40/11/5002/swen/903repap/egarots/aidem/moc .swenned .www .aidem//:ptth .0891 ni nesohc saw eman tnerruc sti erofeb sweN etatS nretsaE dna sweN egelloC s\'rehcaeT demaner saw repap ehT .repapswen yliad a evah ot yrtnuoc eht ni seitisrevinu tsellams eht fo eno si dna 2999031 .1-sserp-lles-ot-setov-draob-aidem-tneduts/seirots-pot/moc .enilnonaxetyliad .www//:ptth sserp gnitnirp repapswen nwo sti nur ot setatS detinU eht ni seitisrevinu eerht ylno fo eno si ytisrevinU sionillI nretsaE';
$subst = ".";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php