in reply to Re^2: Match on line, read backwards to opening xml tag then forward to closing tag
in thread Match on line, read backwards to opening xml tag then forward to closing tag
Move the push inside the if block - only cache the lines between the matches. Also, your condition for printing is tested for each line, so the program might print too early - only set a flag and print after the whole record was read if the flag is set.