in reply to Regex and writing lines in file

If your three lines are not in the string buffer you are matching against already, you cannot solve this with regular expressions. I would maintain a "skip" count to know how many lines to skip:

my $skip; while (<>) { next if $skip--; if( /mypattern/ ) { $skip= 3; } else { print "Have line '$_'"; }; };

If your three lines are in the string buffer already, a new line is defined by the newline character(s) appearing. So you would match three newline charachters with non-newline characters in between them to skip three lines forward.

Without seeing code, it's hard to advise better.