On Sat, 2011-11-26 at 19:46 +0000, Ned Slider wrote:
> # URIs matching http://some.domain.com/profile/12FirstLastname/
> uri           LOCAL_URI_PROFILE 
> m{https?://.{1,40}/profile/\d\d[A-Z][a-z]{1,20}[A-Z][a-z]{1,20}/}
             ^^^^^^^

Using [^/]+ for the domain part instead should be slightly more
efficient, since it will never result in backtracking. Also stricter,
since it anchors the /profile directory at the domain.

Not really that important in this case, but generally worth to keep in
mind.

The upper limit of 40 chars in the original RE is good practice. :)
Though not necessary with mutually exclusive char sets as in my snippet.


-- 
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; }}}

Reply via email to