Code to use regular expressions to add links to URLs in strings under asp <%
'Add the link to the URL in the field.
FunctionToLink(Str)
Dim RE 'Regular expression object Dim strContent
If IsNull(Str) Then Str =
Set RE = New RegExp 'Create a regular expression object
With RE
.Global = True 'Search applies to the entire string
.IgnoreCase = True 'Search case-insensitive
strContent = Str
'************************************************ ****************
'Email address link automatically set
'************************************************ ****************
.Pattern = ([/w]*)@([/w/.]*)
strContent = .Replace(strContent, <A Href='mailto:$1@$2'>$1@$2</A> )
'************************************************ ****************
'Link automatically set
'************************************************ ****************
'======Add the protocol name as required========
Dim D(3), I
D(0) = http
D(1) = ftp
D(2) = news
D(3) = mms
'====================================
For I = 0 To UBound(D)
.Pattern = D(I) + :////([/w/.]*)
strContent = .Replace(strContent, <A Href=' + D(I) + ://$1' target=_blank> + D(I) + ://$1</A> )
Next
'************************************************ ****************
End With
Set RE = Nothing
ToLink = strContent
End Function
%>