Link to home
Start Free TrialLog in
Avatar of hankknight
hankknightFlag for Canada

asked on

ASP.NET / VB: Automatically create email links from a static text

Using ASP.NET / VB, how can I automatically create email links from a static text?

The following code works in PHP but I need it converted to ASP.NET / VB.

<?php

function emailize($text) {
  $regex = '/(\S+@\S+\.\S+)/i';
  $replace = "<a href='mailto:$1'>$1</a>";
  $result = preg_replace($regex, $replace, $text);
  return $result;
}

echo emailize ("Hello World me@example.com Test 123 xyz@example.com");

?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Pryrates
Pryrates
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial