asp | URL 자동 링크 함수
페이지 정보
작성자 100K5 작성일14-05-16 11:11 조회60,244회 댓글0건관련링크
본문
<%
function AutoLink (content)
dim link
Set link = New RegExp
Set link = New RegExp
' First Pass for http
link.Pattern = "(\w+):\/\/([^/:]+)(:\d*\b)?([^# \n<]*).*\n"
link.Pattern = "([0-9a-zA-Z./@:~?&=_-]+)"
link.Pattern = "http://([0-9a-zA-Z./@:~?&=_-]+)"
link.Global = True
link.IgnoreCase = True
link.Pattern = "(\w+):\/\/([^/:]+)(:\d*\b)?([^# \n<]*).*\n"
link.Pattern = "([0-9a-zA-Z./@:~?&=_-]+)"
link.Pattern = "http://([0-9a-zA-Z./@:~?&=_-]+)"
link.Global = True
link.IgnoreCase = True
' ASP seems to be not supporting .MultiLine method.
'link.MultiLine = True
'link.MultiLine = True
content = link.Replace(content,"<a target=_blank href='http://$1'>http://$1</a>")
' 메일주소 자동링크
link.Pattern = "([_0-9a-zA-Z-]+(\.[_0-9a-zA-Z-]+)*)@([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)"
AutoLink = link.Replace(content,"<a href='mailto:$1@$3'>$1@$3</a>")
link.Pattern = "([_0-9a-zA-Z-]+(\.[_0-9a-zA-Z-]+)*)@([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)"
AutoLink = link.Replace(content,"<a href='mailto:$1@$3'>$1@$3</a>")
end function
%>
<%=Autolink(contents)%>
<%
Function UrlLink(content)
Dim regEx
Set regEx = New RegExp
Dim regEx
Set regEx = New RegExp
regEx.Pattern = "([^=""|='](http|https|ftp|telnet|news):\/\/[a-z0-9-]+\.[][a-zA-Z0-9:&#@=_~%;\?\/\.\+-]+)"
regEx.IgnoreCase = True
regEx.Global = True
UrlLink = regEx.Replace(content,"<a href='$1' target='_blank'>$1</a>")
End Function
regEx.IgnoreCase = True
regEx.Global = True
UrlLink = regEx.Replace(content,"<a href='$1' target='_blank'>$1</a>")
End Function
%>
<%=UrlLink(contents)%>
댓글목록
등록된 댓글이 없습니다.