On Tue, Apr 03, 2012 at 05:25:57PM -0400, Kris Deugau wrote: > Henrik K wrote: > >This only checks the "main" message body that SA uses. If you want to check > >_all_ mime parts, here's a quick plugin: > > > >http://sa.hege.li/HTMLComments.pm > > Hm. Does check_html_comment_length get each tag all by itself? > Otherwise it looks like the regex in your while() will match a > message with a short opening comment, $find_len of miscellaneous > content or HTML tags, and a short closing comment.
If you look at it, it's pretty clear. <!--(.*?)--> - Find opening tag <!-- - Stop at first closing tag --> found (non-greedy regex .*?) We capture the contents to check the length. If it's shorted than wanted, just find the next comment block. This testedly works slightly faster than your complex regex which tries to directly find long matches. Or did you mean something else?