On 10/05/2011 10:06 AM, T Elcor wrote: > --- On Wed, 10/5/11, Darac Marjal <[email protected]> wrote: > >>> Is there a way to write a single Javascript regex that >> would match all of the following three patterns: >>> a.domain.tld >>> b.domain.tld >>> domain.tld/c/ >>> >> >> /.*/ >> >> Or, perhaps you're after /domain.tld/ >> >> Either should work, though I'd expect the first to be >> quicker in your case. > No, this isn't what I'm looking for. I'm not after blocking everything or the > whole domain.tld, only the three above URI patterns. > > I came across this trying to rewrite my ad blocking list in a more elegant > way, but couldn't see any obvious way to make it with one regex without > blocking more than necessary.
Well, you didn't say you wanted _only_ that to match. ^(a\.)?domain\.tld(\/c\/)?$ JavaScript syntax might be slightly different, but that's the idea. -- All generalisations are dangerous, including this one. Eduardo M KALINOWSKI [email protected] -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: http://lists.debian.org/[email protected]

