나는이 스크립트를 오랫동안 사용해 왔으며 훌륭하게 작동합니다. RegEx를 사용하여 문자열에서 URL을 찾습니다.
function create_links(strText)
strText = " " & strText
strText = ereg_replace(strText, "(^|[\n ])([\w]+?://[^ ,""\s<]*)", "$1<a href=""$2"" ref=""nofollow"">$2</a>")
strText = ereg_replace(strText, "(^|[\n ])((www|ftp)\.[^ ,""\s<]*)", "$1<a target=""_blank"" ref=""nofollow"" href=""http://$2"">$2</a>")
strText = ereg_replace(strText, "(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)", "$1<a href=""mailto:[email protected]$3"">[email protected]$3</a>")
strText = right(strText, len(strText)-1)
strText = Replace(strText,"." & chr(34) & ">",chr(34) & ">")
strText = Replace(strText,".)" & chr(34) & ">",chr(34) & ">")
create_links = strText
end function
function ereg_replace(strOriginalString, strPattern, strReplacement)
dim objRegExp : set objRegExp = new RegExp
objRegExp.Pattern = strPattern
objRegExp.IgnoreCase = True
objRegExp.Global = True
ereg_replace = objRegExp.replace(strOriginalString, strReplacement)
set objRegExp = nothing
end function
나는 몇 가지 변경을 만들었습니다,하지만 원래는 여기에 ... http://www.ipaste.org/Ycc
제 1 부와 제 3 부 명확하고 아무 문제입니다. 그러나 howto는 효과적인 방법으로 Part 2를 수행합니까? – user1136199