Re: OT: Javascript regex Q

2011-10-05 Thread T Elcor
--- On Wed, 10/5/11, Eduardo M KALINOWSKI wrote: > Well, ([ab]\.domain.tld)|(domain.tld/c/) > > should work and is one regexp, but it is ugly. Yeah, that should work but I was hoping there'd be a more elegant way of doing that. > I'd use two separate ones That's what I'm doing now. -- To

Re: OT: Javascript regex Q

2011-10-05 Thread Tom Furie
On Tue, Oct 04, 2011 at 03:12:58PM -0700, T Elcor 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/ You could try /^[ab]\.domain\.tld$|^domain\.tld\/c\/$/. If you don't mind

Re: OT: Javascript regex Q

2011-10-05 Thread Eduardo M KALINOWSKI
On 10/05/2011 10:39 AM, T Elcor wrote: > I had similar idea >(a\.|b\.|)domain\.tld(|/c/) > but just like your regex it would block the whole domain.tld as well, which > isn't what I want. I overlooked that. Well, ([ab]\.domain.tld)|(domain.tld/c/) should work and is one regexp, but it is u

Re: OT: Javascript regex Q

2011-10-05 Thread T Elcor
--- On Wed, 10/5/11, Eduardo M KALINOWSKI wrote: > > ^(a\.)?domain\.tld(\/c\/)?$ > > JavaScript syntax might be slightly different, but that's > the idea. I had similar idea (a\.|b\.|)domain\.tld(|/c/) but just like your regex it would block the whole domain.tld as well, which isn't what I

Re: OT: Javascript regex Q

2011-10-05 Thread Eduardo M KALINOWSKI
On 10/05/2011 10:06 AM, T Elcor wrote: > --- On Wed, 10/5/11, Darac Marjal 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

Re: OT: Javascript regex Q

2011-10-05 Thread T Elcor
--- On Wed, 10/5/11, Darac Marjal 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 shoul

Re: OT: Javascript regex Q

2011-10-05 Thread Darac Marjal
On Tue, Oct 04, 2011 at 03:12:58PM -0700, T Elcor wrote: > Hi, > > 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, t