Function convertLink(ByVal strText)
Dim mDelimit
Dim re
mDelimit = Chr(0)
Set re = New RegExp
re.Global = True
re.IgnoreCase = true
re.pattern = "\[url=([^]]+)](.+?)\[/url]"
strText = re.replace(strText, "<a href=""$1"">$2</a>")
re.Pattern = "(\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+)"
strText = re.Replace(strText, "<a href=""mailto" & mDelimit & ":$1"">$1</a>")
re.Pattern = "(^|\s)(http://|https://|ftp://|mailto:)(\S)(\S+)"
strText = re.Replace(strText, "$1<a href=""$2$3" & mDelimit & "$4"" target=""_blank"">$3" & mDelimit & "$4</a>")
re.Pattern = "(^|\s)(www\.(\S)(\S+))"
strText = re.Replace(strText, "$1<a href=""http://$2"" target=""_blank"">$2</a>")
strText = Replace(strText, mDelimit, "")
convertLink=strText
End Function
Frågan#1
Har denna funktion som jag hittat här på WF
Function convertLink(ByVal strText)
Dim mDelimit
Dim re
mDelimit = Chr(0)
Set re = New RegExp
re.Global = True
re.IgnoreCase = true
re.Pattern = "(\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+)"
strText = re.Replace(strText, "<a href=""mailto" & mDelimit & ":$1"">$1</a>")
re.Pattern = "(http://|https://|ftp://|mailto:)(\S)(\S+)"
strText = re.Replace(strText, "<a href=""$1$2" & mDelimit & "$3"" target=""_blank"">$2" & mDelimit & "$3</a>")
re.Pattern = "(www\.(\S)(\S+))"
strText = re.Replace(strText, "<a href=""http://$1"" target=""_blank"">$1</a>")
strText = Replace(strText, mDelimit, "")
convertLink=strText
End Function
om jag skickar in en adress innesluten i [ url = http: / / ww w.adress . se]nätadress [/ url ] (ursäkta mellanslagen men WF parsar annars strängnen som länk ;)
Så vill jag ju ha ordet "nätadress" länkat till adressen som anges i "url=" ... men jag får ut en sträng som ser en aning konstig ut... jag bifogar en screenshot.
Jag får inte ihop det... vad gör jag för fel?

