the other time you mentioned it, I *almost* brought up Linux-libre's deblob-check. it contains scripts in various scripting languages that match multi-line regular expressions. maybe you could use that next time you need it ;-)
Oh my goodness. I looked at that script. It's... impressive :-).