On Thu, 2011-04-21 at 15:47 -0800, Kevin Miller wrote: > Karsten Bräckelmann wrote: > > What you want. The string '<br>', repeated five times (or more). For > > the quantifier, you need to group the string. > > > > /(?:<br>){5}/
> Great. I've changed my rule to that, and am going to look at Adam's > somewhat enhanced version to understand what all it's doing. To wit: > rawbody LOCAL_5X_BR_TAGS /(?:<br\/?>[\s\r\n]{0,4}){5}/mi That should do the trick indeed. After this, I strongly suggest to carefully re-read the entire thread, and read some docs specifically about the points raised. That includes RE peculiarities [1] you used with previous REs without knowing them, as well as my escaping notes with using the shell. > I note that Adam used rawbody rather than body, so I presume that I > should change my rule to that as well. Yup, he explained why you need that -- otherwise, HTML tags are not preserved verbatim, but HTML parts rendered and normalized. [1] PCRE flavor, Perl Compatible REs. -- 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; }}}