Return to Snippet

Revision: 33503
at October 11, 2010 12:19 by tomsyweb


Updated Code
str.replace(/((http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi, '<a href="$1">$1</a>');

Revision: 33502
at October 9, 2010 04:25 by tomsyweb


Initial Code
str.replace(/((http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/, '<a href="$1">$1</a>');

Initial URL


Initial Description


Initial Title
Add  link tags to strings that begin with http or https

Initial Tags
regexp

Initial Language
JavaScript