webForumDet fria alternativet

replace kanske ?

1 svar · 131 visningar · startad av jonne

jonneMedlem sedan jan. 20011 154 inlägg
#1

Litet problem.
Vill kunna skriva följande.
[mail]anv@host.com[/mail] och få följande i htmlkoden:
A HREF="mailto:anv@host.com">anv@host.com</a>

Har lyckats med div replace funktioner att få in adressen i ahref men hur ska jag få det så att adressen även syns på sidan och inte bara i html koden ?

------------------
//Jonne, a beliver of murphys law

skarbrattMedlem sedan juli 2000325 inlägg
#2

Använd istället:

strText = "Din text bla bla info@fencing4u.nu samt <A HREF="http://www.fencing4u.nu"" TARGET=_blank>www.fencing4u.nu"</A> 
						mDelimit = Chr(0)        
						Set re = New RegExp        
						re.Global = True        
						re.IgnoreCase = true        
						re.Pattern = "(\w+((-\w+)&#0124;(\.\w+))*\@[A-Za-z0-9]+((\.&#0124;-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+)"       
						strText = re.Replace(strText, "<a href=""mailto" & mDelimit & ":$1"">$1</a>")                
						re.Pattern = "(http://&#0124;https://&#0124;ftp://&#0124;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, "")

------------------
fencing for you?
http://www.fencing4u.nu/

134 ms totalt · 3 externa anrop · v20260731065814-full.3ab8d573
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
131 ms — hämta tråd, inlägg och bilagor (db)