On Thu, 2014-05-22 at 13:47 -0700, John Hardin wrote: > On Thu, 22 May 2014, James B. Byrne wrote:
> > rawbody RAW_BLANK_LINES_05 /(\r?\n){5,9}/i > Regular expressions by default only consider a single line of text. You Nope. You're thinking about ^ and $ by default only matching the beginning and end of the string. A \n newline is just an ordinary char. REs don't know the concept of lines, they operate on a string. > 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 The /m modifier changes ^ and $ to match anywhere in the string. -- char *t="\10pse\0r\0dtu\0.@ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4"; main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1: (c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}