#!/usr/bin/env perl use strict; use warnings; while () { if (/^regex1/ .. /^regex3/) { last if /^regex3/; print; } } __DATA__ PRE REGEX LINES regex1 - grab general informations about regex1 grab more informations on this line about regex1 regex2 - grab general informations about regex2 grab more informations on this line about regex2 regex3 - grab general informations about regex3 grab more informations on this line about regex3 POST REGEX LINES #### regex1 - grab general informations about regex1 grab more informations on this line about regex1 regex2 - grab general informations about regex2 grab more informations on this line about regex2