On Fri, 2009-09-25 at 11:37 -0700, John Hardin wrote: > On Fri, 25 Sep 2009, Guillaume Gelle wrote: > > > Don't know what you mean by (?:) and backtracking tho, I'll double check > > the wiki page about syntax ;)
The (?:foo|bar) is a non-capturing, pure alternation, indicated by the ?: after the opening parenthesis -- whereas the () form does capture the match for later access. Needless in this case. Oh, and Dan probably meant to say capturing, instead of backtracking. > Try this: > uri URI_GOOG_READER m;^https?://(?:www\.)?google[\.,]com/reader/;i Thanks for getting rid of the fences. :) One of the notes I was about to say. If your RE is going to contain literal slashes, use the generic m// with custom delimiters, rather than the // shortcut. Another note which I've seen here before: Drop the [.,] for the host part of a uri rule. It's not a URI if it contains a comma, it'll be the dot. (And you don't need to escape the dot in a char [class] anyway. :) -- char *t="\10pse\0r\0dtu...@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; }}}