On 4/4/06, dblack / wobblini.net <dblack / wobblini.net> wrote:
> Hi --
>
> On Wed, 5 Apr 2006, Clint Pidlubny wrote:
>
> > Hello,
> >
> > What is the best approach to searching a string for another string?
> >
> > For instance, I have:
> >
> > url1 = 'http://www.url.com'
> > url2 = 'http://www.url.com/page'
> >
> > If part of url1 is in url2, like above, I'd like to declare it a
> > match. I'm sure this happens using a regular expression, but my
> > experience is limited with them.
> >
> > The other problem is that I'm not going to be looking for just one
> > url1, but I have an entire database table full of those to compare to
> > an entire database table of url2.
> >
> > Any thoughts on approaching this problem are appreciated.
>
> It's not a complete answer, but in case it helps: String has an
> include? method:
>
>    url2.include?(url1) => true
>
>
> David
>
> --
> David A. Black (dblack / wobblini.net)
> Ruby Power and Light, LLC (http://www.rubypowerandlight.com)
>
> "Ruby for Rails" chapters now available
> from Manning Early Access Program! http://www.manning.com/books/black
>
>

I can't think of why that wouldn't work. Thank you.

Clint