fork download
  1. <?php
  2. $string = '//replace me please
  3. dont touch http://www.google.com
  4. or //this one
  5. //but this one do as well';
  6. $regex = '/^\h*\/\/(.*)$/m';
  7. echo preg_replace($regex, '/*$1*/', $string);
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
/*replace me please*/
dont touch http://www.google.com
or //this one
/*but this one do as well*/