in reply to Remove comments between delimiters

Thanks Monks, I did this and works
$question =~ s/\*(.*?)\*//g;

Replies are listed 'Best First'.
Re: Re: Remove comments between delimiters
by mirod (Canon) on Sep 20, 2002 at 13:25 UTC

    It might not matter in your case, but this will only catch comments that start and end on the same line, as the '.' does not match the newlines.

    You can try these:

    $question =~ s/\*.*?\*//sg; # the s modifier causes . to match newlines

    or

    question =~ s/\*[^*]*\*//sg; # [^*] matches the newlines too

    Update: added a * in the second regexp (thanks swiftone) and removed the (), you don't need to capture the comments.