REGEX ASP Classic Replace

Asked

Viewed 203 times

0

How can I take a large text full of ulrs and upload them to links in ASP CLASSIC 3 using REGEX? I wanted to add this code. Get in the replace down there I have no idea...

This Regex there, houses all url, but how to replace and transfer them in link?

texto="Lorem ipsum dolor www.stackoverflow.com sit amet, consectetur adipiscing elit"


Set regx = New RegExp
regx.IgnoreCase = True
regx.Global = True
regx.Pattern = "/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,}/gi"
texto_saida = regx.Replace(texto, "<a href='http$2://www$3.$4$5$6'>$1</a> ")

Set regx = Nothing

response.write texto_saida

1 answer

0

Try that code

texto="Lorem ipsum dolor www.stackoverflow.com sit amet, consectetur adipiscing elit"
Set regx = New RegExp
regx.IgnoreCase = True
regx.Global = True
regx.Pattern = "([a-z]{3,})\.([a-z]{1,})\.([a-z\.]{1,})"
texto_saida = regx.Replace(texto, "<a href='http://$1.$2.$3'>$1.$2.$3</a> ")
Set regx = Nothing
response.write texto_saida

Browser other questions tagged

You are not signed in. Login or sign up in order to post.