I have code like this
function get_id(){
return 1;
//
}
I want to remove all //
inside the source code, but only those stand by it own, on a newline just like the example here. Nothing much nothing more. How can I do it?
I have code like this
function get_id(){
return 1;
//
}
I want to remove all //
inside the source code, but only those stand by it own, on a newline just like the example here. Nothing much nothing more. How can I do it?
Search using this regex:
^\s*\/\/\s*$
and replace by empty string.
If using PHP you can use \h
(horizontal space) instead of \s
:
$code = preg_replace('~^\h*//\h*$~m', '', $code);