Copy Code code as follows:
Function Autolinkurls (strstring)
Dim match, matches, offset, url, email, link, relnkautolinkurl
Relnkautolinkurl = "<a href=" "[[%url%]]" ">[[%URLText%]]</a>"
If not IsObject (REGEXP) Then Set regExp = New regExp
Regexp.global = True
Regexp.ignorecase = True
' Look for URLs
Regexp.pattern = "((ht|f) tps?:/ /)| (www\.)) ([\w-]+\.) +[\w-:]+ (/[\w-/?%#;&=]*)? "
Set matches = Regexp.execute (strstring)
Offset = 0
For the match in matches
url = match
If Left (URL, 4) = "www." Then url = "http://" & URL
link = replace (replace (Relnkautolinkurl, [[%urltext%]], match), [[[%url%]], URL)
strstring = Mid (strstring, 1, match. FirstIndex + offset) & link & Mid (strstring, match. FirstIndex + 1 + match. Length + offset, Len (strstring))
Offset = offset + len (link)-len (Match)
Next
' Look for emails
Regexp.pattern = "[a-za-z0-9_+-."] +@\w+ ([-.] \w+) *\.\w+ ([-.] \w+) * "
Set matches = Regexp.execute (strstring)
Offset = 0
For the match in matches
email = match
link = replace (replace (Relnkautolinkurl, "[[%urltext%]]", match), "[[%url%]]", "mailto:" & email)
strstring = Mid (strstring, 1, match. FirstIndex + offset) & link & Mid (strstring, match. FirstIndex + 1 + match. Length + offset, Len (strstring))
Offset = offset + len (link)-len (Match)
Next
Autolinkurls = strstring
End Function