---
title: "Skapa mailto-länk vid epostadresser."
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/137681-skapa-mailto-länk-vid-epostadresser"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "Oputres"
published: "2005-11-15T15:45:25.000Z"
updated: "2005-11-15T16:40:39.000Z"
replies: 2
views: 220
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/137681-skapa-mailto-länk-vid-epostadresser"
---

# Skapa mailto-länk vid epostadresser.

## #1 — Oputres, 2005-11-15T15:45Z

Allå! Jag har då nedanstående funktion som skapar klickbara länkar av webbadresser. Kan man integrera till i samma funktion att den skapar mailto-länkar om man skriver in en epostadress?

```
Function Visa(s)
dim objRE, m, o
On error resume next
Set objRE = new RegExp 
objRE.IgnoreCase = True : objRE.Global = True 
objRE.Pattern = "(http:\/\/|www\.)(\w|\&|\:|\;|\.|\/|\?|\~|\=|-)+"
Set m = objRE.Execute(s) 
For Each o In m 
If Right(o.Value, 1)="." Or Right(o.Value, 1)="!" Or Right(o.Value, 1)="?" Or Right(o.Value, 1)="," Then 
If Left(o.Value, 3) = "www" Then s = Replace(s, o.Value, "<A HREF=""http://" & Left(o.Value, Len(o.Value)-1) & """ target=""_blank"">" & Left(o.Value, Len(o.Value)-1) & "</A>" & Right(o.Value, 1)) Else s = Replace(s, o.Value, "<A HREF=""" & Left(o.Value, Len(o.Value)-1) & """>" & Left(o.Value, Len(o.Value)-1) & "</A>" & Right(o.Value, 1)) 
Else 
If Left(o.Value, 3) = "www" Then s = Replace(s, o.Value, "<A HREF=""http://" & o.Value & """ target=""_blank"">" & o.Value & "</A>") Else s = Replace(s, o.Value, "<A HREF=""" & o.Value & """ target=""_blank"">" & o.Value & "</A>") 
End If 
Next 
Set objRE = Nothing
```

Permalänk: https://www.webforum.nu/p/137681

## #2 — Peter S, 2005-11-15T15:54Z

Exempel:

```
Function Visa(s)
dim objRE, m, o
On error resume next
Set objRE = new RegExp 
objRE.IgnoreCase = True : objRE.Global = True 
objRE.Pattern = "(http:\/\/|www\.)(\w|\&|\:|\;|\.|\/|\?|\~|\=|-)+"
Set m = objRE.Execute(s) 
For Each o In m 
If Right(o.Value, 1)="." Or Right(o.Value, 1)="!" Or Right(o.Value, 1)="?" Or Right(o.Value, 1)="," Then 
If Left(o.Value, 3) = "www" Then s = Replace(s, o.Value, "<A HREF=""http://" & Left(o.Value, Len(o.Value)-1) & """ target=""_blank"">" & Left(o.Value, Len(o.Value)-1) & "</A>" & Right(o.Value, 1)) Else s = Replace(s, o.Value, "<A HREF=""" & Left(o.Value, Len(o.Value)-1) & """>" & Left(o.Value, Len(o.Value)-1) & "</A>" & Right(o.Value, 1)) 
Else 
If Left(o.Value, 3) = "www" Then s = Replace(s, o.Value, "<A HREF=""http://" & o.Value & """ target=""_blank"">" & o.Value & "</A>") Else s = Replace(s, o.Value, "<A HREF=""" & o.Value & """ target=""_blank"">" & o.Value & "</A>") 
End If 
Next 

objRE.Pattern = "([^\s]+@([^\s]+\.)+\w{2,6})"
Visa = objRE.replace(s, "<a href=""mailto:$1"">$1</a>")
Set objRE = Nothing
end function
```

Permalänk: https://www.webforum.nu/p/1710767

## #3 — Oputres, 2005-11-15T16:40Z

Underbart!

Permalänk: https://www.webforum.nu/p/1710782

---

Tråden på webben: https://www.webforum.nu/amne/asp/137681-skapa-mailto-länk-vid-epostadresser
