in reply to regexp matching bad stuff ...

Not a direct solution, but perhaps consider using something like Logfile::Access or Regexp::Log::Common rather than reinventing this particular wheel.

The cake is a lie.
The cake is a lie.
The cake is a lie.