Robert Klemme
9/7/2007 9:54:00 AM
2007/9/7, Diego Suarez <diego.suargarcia@gmail.com>:
> The boundaries could be a good idea, but if he needs urls like
> ciscosystems.com, with the final \b won't match. Keep that in sight :)
>
> On 9/7/07, S P Arif Sahari Wibowo <arifsaha@yahoo.com> wrote:
> >
> > On Fri, 7 Sep 2007, Charles Pareto wrote:
> > > file.each { |line| print line if line =~ /(C|c)isco|CISCO/ }
> > ...
> > > Does anyone know how I can modify my reg exp to not include
> > > certain keywords like SanFrancisco and Francisco?
> >
> > How about:
> > /\b([Cc]isco|CISCO)\b/
> >
> > or even
> >
> > /\bcisco\b/i
I'd probably use a second rx like
file.each { |line| print line if line =~ /\bcisco/i && line !~ /sanfrancisco/i}
Kind regards
robert