> >> I'll take a closer look, but I think it's an (A B)|(B C) situation and
> >> you're looking at B there.
> >
> > Indeed, that's exactly it.
>
> Can you suggest a neater solution for (A B)|(B C) than duplicating B?
Nope, there is none. Not with that exact logic. However, if it is part
of a larger RE, making A optional *might* be a slightly fuzzy option,
changing the logic and required patterns.
Once a trivial (A B)|(B C) grows really large, due to alternations
within each sub-pattern, a meta of two sub-rules of course becomes an
option. Basically, that's exactly the same, just splitting the rule in
two. Might make ghastly rules more maintainable.
--
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; }}}