Richard, thank you so much.  Your example worked in my quick test.
Now will try with multiple occurrences of  urls in the same string,
etc...

Thanks again,
John

On Aug 24, 11:26 am, Richard Quadling <rquadl...@gmail.com> wrote:
> On 24 August 2010 16:23, Richard Quadling <rquadl...@gmail.com> wrote:
>
>
>
> > On 22 August 2010 14:52, johnwerry <john.we...@gmail.com> wrote:
> >> Trying to get the following gsub call working to replace text of url
> >> with link of the url.  I know I have to add slashes, but I am
> >> apparently missing some, somewhere as I can never get it to not error
> >> out.
>
> >> txt = txt.gsub(/\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|
> >> ([^[:punct:]\s]|/)))/,'<a href="#{0}">#{0}</a>');
>
> >> Here is the "add slashes" version of the first parameter, but this
> >> errors out at runtime.  What am I missing?
>
> >> /\\b(([\\w-] ://?|www[.])[^\\s()<>] (?:\\([\\w\\d] \\)|([^[:punct:]\
> >> \s]|/)))/
>
> >> --
> >> You received this message because you are subscribed to the Google Groups 
> >> "Prototype & script.aculo.us" group.
> >> To post to this group, send email to 
> >> prototype-scriptacul...@googlegroups.com.
> >> To unsubscribe from this group, send email to 
> >> prototype-scriptaculous+unsubscr...@googlegroups.com.
> >> For more options, visit this group 
> >> athttp://groups.google.com/group/prototype-scriptaculous?hl=en.
>
> >http://pastebin.com/0E5MDkk2is the same, but hopefully a little easier to 
> >read.
>
> > --
> > Richard Quadling.
>
> Can you try ...
>
> result = 
> subject.replace(/\b(https?|ftp|file):\/\/[\-A-Z0-9+&@#\/%?=~_|!:,.;]*[A-Z0-9+&@#\/%=~_|]/img,
> '<a href="$&">$&</a>');
>
> and pastebinhttp://pastebin.com/Ytc4KRT0
>
> --
> Richard Quadling.

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to