TestStr = \"Se dette billede[image=www.inet.dk/billede.jpg] det er flot.\"
Functionen i dette svar laver stengen TestStr om til:
\"Se dette billede [image=www.inet.dk/billede.jpg] det er flot.\"
Function imageStringToLink2(strInput)
Set objRegExpHTTP1 = New RegExp
Set objRegExpHTTP2 = New RegExp
objRegExpHTTP1.Pattern = \"(\\[image=)(http|ftp)(:\\/\\/[\\w\\._-]+\\.[\\w\\._-]+\\S*)(\\])\"
objRegExpHTTP2.Pattern = \"(\\[image)(^|[^\\/])(www[^\\.\\s]?\\.[\\w\\._-]+\\.[A-Za-z]{2,3}\\S*)(\\])\"
objRegExpHTTP1.Global = True
objRegExpHTTP2.Global = True
objRegExpHTTP1.IgnoreCase = True
objRegExpHTTP2.IgnoreCase = True
strOutput = objRegExpHTTP1.Replace(strInput, \" $1<a href=\'$2$3\' target=\'_blank\'>$2$3</a>$4 \")
strOutput = objRegExpHTTP2.Replace(strOutput, \" $1=<a href=\'
http://$3\' target=\'_blank\'>$3</a>$4 \")
Set objRegExpHTTP2 = Nothing
set objRegExpHTTP1 = Nothing
imageStringToLink2 = strOutput
End Function