# HG changeset patch # User Heiko Schlittermann (JUMPER) # Date 1428610016 -7200 # Node ID e7f889e6979090e94d07e4296bb15c96da89b61e # Parent 664b775b56bd3eeec25392fd89fba0d802502244 better regex for removing the comments diff -r 664b775b56bd -r e7f889e69790 lib/DNS/Vi.pm --- a/lib/DNS/Vi.pm Thu Apr 09 13:56:03 2015 +0200 +++ b/lib/DNS/Vi.pm Thu Apr 09 22:06:56 2015 +0200 @@ -33,8 +33,11 @@ foreach (@lines) { # simplificated comment remover # after the comment character no '"' is allowed! - s{^\s*;.*$}{}; # strip comment lines - s{\s*;[^"]*$}{}; # strip trailing comments +# s{^\s*;.*$}{}; # strip comment lines +# s{\s*;[^"]*$}{}; # strip trailing comments + + # see https://regex101.com/r/cG6fK3/2 + s{\s*(?:;)(?:(?:[^"]|"[^"]*")*$)}{}; state $line; if (my $range = /(.*)\(\s*$/ .. /(.*)\)\s*/) { $line .= defined $1 ? $1 : $_;