JENKINS-17651. Add support for multi-line pattern matches

Pardon the import rearrangements - freakin' IDEs.