Finding a url in a string and turning it into a link

i have a string that can have one or more urls within the string. i’m wanting to use javascript to find the urls and turn them into links.

i know you’d do a search with a regular expression, but i can’t find the correct one on the web…even though i know there has to be a billion examples out there. my google search skills are s#&@ today.

before: “some text telling me to visit http://www.something.com and http://more.com

after: “some text telling me to visit http://www.something.com and http://more.com

str.replace(/(https?:\\/\\/[\\w\\.]+[a-z]{2,})\\b/gi, '<a href="$1">$1</a>')

well… i didn’t tell the first url to be a link, but i’m guessing sitepoint is doing something similar to what i wanna do; except i want urls without a “www” to work, as well.