in reply to Comments regex

Use $RE{comment}{JavaScript} from Regexp::Common::comment:

use warnings; use strict; use Regexp::Common qw/comment/; my $sample = <<'END_SAMPLE'; Hello // World a /* test */ b xyz /* asdf qwertz /* uiop */ ijk END_SAMPLE $sample =~ s/$RE{comment}{JavaScript}//g; print $sample; __END__ Hello a b xyz ijk

Replies are listed 'Best First'.
Re^2: Comments regex
by kepler (Scribe) on Feb 25, 2020 at 10:44 UTC

    Hi

    Great solution. I did not knew about that module - it's just incredible. Thank you so much. Best regards