in reply to How regexes fail.

There is a heinous trick you can use that I described at Re: Regexes on Streams.

See File::Stream for an implementation of the idea.