I''m trying to scan some text to find any thing that has an http:// and convert it into a link, if it does not allready have and anchor on it. excuse my beginner aproch but what I''ve been doing is converting the string into an array and looking for anything that starts with http:// and apending <a href=".."> and </a> to it. I cant help but think I''m going around the long with this by converting it into an array. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You might want to look into hpricot: http://code.whytheluckystiff.net/hpricot/ I''ve found it useful for things like this. RSL On 1/21/07, Phil Cooperking <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > I''m trying to scan some text to find any thing that has an http:// and > convert it into a link, if it does not allready have and anchor on it. > excuse my beginner aproch but what I''ve been doing is converting the > string into an array and looking for anything that starts with http:// > and apending <a href=".."> and </a> to it. I cant help but think I''m > going around the long with this by converting it into an array. > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 1/21/07, Phil Cooperking <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I''m trying to scan some text to find any thing that has an http:// and > convert it into a link, if it does not allready have and anchor on it. > excuse my beginner aproch but what I''ve been doing is converting the > string into an array and looking for anything that starts with http:// > and apending <a href=".."> and </a> to it. I cant help but think I''m > going around the long with this by converting it into an array.Have you looked at the auto_link Rails helper method? http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M000621 -- Chris Wanstrath http://errtheblog.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---