On Thu, 22 May 2014, James B. Byrne wrote:

I am clearly missing something with these rules but I lack the experience to
see what it is:

score RAW_BLANK_LINES_05 0.5
rawbody RAW_BLANK_LINES_05 /(\r?\n){5,9}/i
describe RAW_BLANK_LINES_05 Raw body contains 5 or more consecutive empty lines
score RAW_BLANK_LINES_10 1.0
rawbody RAW_BLANK_LINES_10 /(\r?\n){10,24}/i
describe RAW_BLANK_LINES_10 Raw body contains 10 or more consecutive empty lines
score RAW_BLANK_LINES_15 1.5
rawbody RAW_BLANK_LINES_15 /(\r?\n){25}/
describe RAW_BLANK_LINES_15 Raw body contains 25 or more consecutive empty lines

Regular expressions by default only consider a single line of text. You need to provide an option to say "treat multiple lines as a single line".
Try this:

  rawbody RAW_BLANK_LINES_05 /(?:\r?\n){5,9}/m
  rawbody RAW_BLANK_LINES_10 /(?:\r?\n){10,24}/m
  rawbody RAW_BLANK_LINES_15 /(?:\r?\n){25}/m

The case-insensitive flag is not meaningful for these rules as there's no attempt to match text, and I added the ?: to make the groups non-capturing, which is a bit more efficient.

--
 John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
 jhar...@impsec.org    FALaholic #11174     pgpk -a jhar...@impsec.org
 key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
 Windows and its users got mentioned at home today, after my wife the
 psych major brought up Seligman's theory of "learned helplessness."
                                             -- Dan Birchall in a.s.r
-----------------------------------------------------------------------
 4 days until Memorial Day - honor those who sacrificed for our liberty

Reply via email to