I am trying to use regular expression to delete comments using
in a file.
The code is as follows-
The 'AFTER' print out is identical to the 'BEFORE' print!
gives error /(/*)(.*)(*/)/: ?+*{} follows nothing in regexp at comment.pl line 4.
The problem is that * and \ are both escape character, I think.
Code:
/* whatever */
The code is as follows-
Code:
$fileContent; #Content of file contains /* */ and
print "BEFORE\n" . $fileContent . "\n---------------\n";
$fileContent=~ s/\/\*(.*)\*\///g;
print "AFTER \n" . $fileContent;
The 'AFTER' print out is identical to the 'BEFORE' print!
Code:
$fileContent=~ s/(\/\*)(.*)(\*\/)//g;
gives same print out.
[code]$fileContent=~ s/(\/*)(.*)(*\/)//g;
The problem is that * and \ are both escape character, I think.