Is there any regular expression that is able to remove all comments of the // and /**/ variety from a given C program say in perl?
Given the multi-line program, it should use the regular expression to remove the comments and return the non-commented out portion.
Thanks.
Try with Regexp::Common::comment:
use Regexp::Common qw /comment/;
while (<>) {
s/($RE{comment}{C++})//;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With