//urlify - turn URL's into HTML links var text = "Check the website, http://www.oreilly.com/catalog/regexppr."; var regex = "\b" // start at word boundary + "(" // capture to $1 + "(https?|telnet|gopher|file|wais|ftp) :" // resource and colon + "[\w/\#~:.?+=&%@!\-]+?" // one or more valid chars // take little as possible + ")" + "(?=" // lookahead + "[.:?\-]*" // for possible punct + "(?:[^\w/\#~:.?+=&%@!\-]"// invalid character + "|$)" // or end of string + ")"; text.replace(regex, "<a href="$1">$1</a>");
3.147.76.89