codice:
<%
'Function isUrl , stringa regexp per il riconoscimento url presa da http://www.regexp.org/31,è da testare con l'esempio sotto
Function isUrl(strURL)
Dim objRegExp
Set objRegExp = New RegExp
objRegExp.Pattern = "\b((((ht|f)tps?://)|([a-zA-Z0-9_-]+:[a-zA-Z0-9_-]+)?(www|ftp)\.)[a-zA-Z0-9\.\#\@\;\:%&_/\?\=\~\-]+)"
objRegExp.IgnoreCase = True
isUrl = objRegExp.Test(strURL)
End Function
%>
<html>
<body>
<form name="form" action="">
<input type="text" name="text" value="<%=Request("text")%>" style="width:70%">
<input type="submit" name="action" value="TESTA">
</form>
<%
if Request("action") <> "" then
mex = request("text")
if isUrl(mex) then
if Instr(mex,"http://") <> 0 or Instr(mex,"ftp://") <> 0 or Instr(mex,"https://") <> 0 then %>
Il testo immesso <%=mex%> è un link<%=mex%>!
<% else
if Instr(1,mex,"ftp.") <> 0 then %>
Il testo immesso <%=mex%> è un link<%=mex%>!
<% else %>
Il testo immesso <%=mex%> è un linkhttp://<%=mex%>!
<% end if
end if
' elseif IsEmail(mex) then 'funzione BY weppos la trovi su http://www.weppos.com/asp/script_sho...ipt=374&cat=19
' Il testo immesso <%=mex% > è un email<%=mex% >!
else %>
Il testo immesso <%=mex%> non risulta essere ne un URL valido ne un email valida
<% end if
end if %>