in reply to Regular Expression help

use strict; use warnings; while (<DATA>) { while (/(\bSPORT\b.*?\bEND\b)/g) {print "$1\n"} } __DATA__ your long line here
perlrequick, perlretut

Replies are listed 'Best First'.
Re^2: Regular Expression help
by 7stud (Deacon) on Nov 05, 2009 at 22:39 UTC
    Which "SPORT" and which "END"?
Re^2: Regular Expression help
by colwellj (Monk) on Nov 05, 2009 at 22:40 UTC
    Won't the greedy flag give him every thing between the first SPORT and the last END as a single string?
      It's not a 'greedy' flag. Regular expressions are greedy by default--you don't need a flag for that. The proposed solution actually turns off the greedy nature of a regex by using a non-greedy match: .*?
      What happened when you ran the code I posted using the OP's data?