Thank you.. but yes.. the problem is that it has to detect links at the beginning and the end. and also it has to check for HREF, because sometimes you can have the quotation marks before the link, even if it's not precedeed by href. Is there a better solution? thank you Robert Klemme wrote: > On 05.02.2007 21:37, David Krmpotic wrote: >> href=\'\0\'>\0</a>') >> >> either and it also screws \n ... ) > Maybe it's enough to do > > s.gsub( /([^"'])\b(http[^\s"']+)\b([^"'])/, > '\\1\\2\\3' ) > > That depends on your input text. This piece has some weaknesses, e.g. > won't substitute hrefs at the beginning and end of the string (you could > pad with a whitespace). > > Kind regards > > robert -- Posted via http://www.ruby-forum.com/.