Hjælp med omgøring til HTML tags
Jeg har følgende funktion som gør URLer om til henholdsvis hyperlink- og imagetagsFunction LinkString2(strInput)
Set objRegExpHTTP1 = New RegExp
Set objRegExpHTTP2 = New RegExp
objRegExpHTTP1.Global = True
objRegExpHTTP2.Global = True
objRegExpHTTP1.IgnoreCase = True
objRegExpHTTP2.IgnoreCase = True
objRegExpHTTP1.Pattern = "(http|ftp)(:\/\/[\w\._-]+\.[\w\._-]+\S*?)(\.)(gif|jpg|jpeg|bmp|png)"
strOutput = objRegExpHTTP1.Replace(strInput, "<img src=""$1$2$3$4"">")
objRegExpHTTP1.Pattern = "(^|[^\/])(www\.)([\w\._-]+\.[\w\.-\/]+\S*?)(\.)(gif|jpg|jpeg|bmp|png)"
strOutput = objRegExpHTTP1.Replace(strOutput, "$1<img src=""http://$2$3$4$5"">")
objRegExpHTTP1.Pattern = "([^src=""])(http|ftp)(:\/\/[\w\._-]+\.[\w\._-]+\S*)"
objRegExpHTTP2.Pattern = "(^|[^\/])(www)(\.[\w]+)([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?"
strOutput = objRegExpHTTP1.Replace(strOutput, " <a href='$1$2$3' target='_blank'>$1$2$3</a> ")
strOutput = objRegExpHTTP2.Replace(strOutput, " $1<a href='http://$1$2$3$4' target='_blank'>$1$2$3$4</a> ")
objRegExpHTTP2.Pattern = "(<br>|[,.)\]\}])('>)"
strOutput = objRegExpHTTP2.Replace(strOutput, "$2")
objRegExpHTTP2.Pattern = "(<br>|[,.)\]\}])(' target=)"
strOutput = objRegExpHTTP2.Replace(strOutput, "$2")
objRegExpHTTP2.Pattern = "(<br>|[,.)\]\}])(</a>)"
strOutput = objRegExpHTTP2.Replace(strOutput, "$2$1")
Set objRegExpHTTP2 = Nothing
set objRegExpHTTP1 = Nothing
LinkString2 = strOutput
End Function
Problemet er bare at funktionen ikke "finder" URLer uden www. Linker som http://eksperten.dk blir ikke omgjort til HTML tags, mens http://www.eksperten.dk blir.
Nogle som kan hjælpe mig med at ændre dette i funktionen?
