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;
In reply to Re: Re: Removing nested comments with regexes
by Anonymous Monk
in thread Removing nested comments with regexes
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |