summaryrefslogtreecommitdiffstats
path: root/contrib/mumble-autolink.tengo
blob: 527ff6f13391fda15ef20a92552d958cfa8cd26a (plain) (blame)
1
2
3
4
5
6
text := import("text")

if outProtocol == "mumble" {
    urlRE := text.re_compile(`(?is)((http|https):\/\/)?([a-z0-9-]+\.)?[a-z0-9-]+(\.[a-z]{2,6}){1,3}(\/[a-z0-9.,_\/~#&=;%+?-]*)?`)
    msgText = urlRE.replace(msgText,`<a href="$0">$0</a>`)
}