Re: regex alternation question

2004-05-21 Thread Jose Alves de Castro
On Thu, 2004-05-20 at 21:22, Rich Fernandez wrote: > I'm unclear about how alternation works in a regex. > > Say I want to find either "foo" or "bar" within a string. I don't care which > one I match, only that I make a match. > Would this be correct: /foo|bar/ > > Should they be grouped thusl

RE: regex alternation question

2004-05-20 Thread Hanson, Rob
, May 20, 2004 4:23 PM To: '[EMAIL PROTECTED]' Subject: regex alternation question I'm unclear about how alternation works in a regex. Say I want to find either "foo" or "bar" within a string. I don't care which one I match, only that I make a match. Would

regex alternation question

2004-05-20 Thread Rich Fernandez
I'm unclear about how alternation works in a regex. Say I want to find either "foo" or "bar" within a string. I don't care which one I match, only that I make a match. Would this be correct: /foo|bar/ Should they be grouped thusly: /(foo|bar)/ What about /(?:foo|bar)/ ? Specifically, I k