in reply to Re: Removing nested comments with regexes
in thread Removing nested comments with regexes

Thanks for the substitution idea!

I removed the "$" and the from the regex since it wouldn't match the data correctly. Also in your example there is no longer a grouping on $1. Here is the fixed code:

my $count = 1; my $string = "--This is a comment\n--This Comment continues here\nNOT +a comment;\n"; print "Original: $string\n"; while ($string =~ s/^--.*\n//m) { print "string = $string\ncount=$count\n"; $count++; } print "Final: $string\n"; exit;