M
Max Williams
On our site, our resources have a description, which is often copied and
pasted from somewhere else. Often these descriptions have urls in them,
just as normal text, and i'd like to automatically make these into
working links.
I was thinking of using gsub as below:
def description_with_links
regex = ????
self.description.gsub(regex) {|url|"<a href=\'#{url}'>#{url}</a>"}
end
The above should work ok, once i have the regex but i can't work it out.
Can anyone help?
thanks
max
pasted from somewhere else. Often these descriptions have urls in them,
just as normal text, and i'd like to automatically make these into
working links.
I was thinking of using gsub as below:
def description_with_links
regex = ????
self.description.gsub(regex) {|url|"<a href=\'#{url}'>#{url}</a>"}
end
The above should work ok, once i have the regex but i can't work it out.
Can anyone help?
thanks
max