$HostnameRegex = qr/[-a-z0-9]+(\.[-a-z0-9]+)*\.(com|edu|info)/i; # Turn email addresses into links . . . $text =~ s{ \b # Capture the address to $1 . . . ( \w[-.\w]* # username \@ $HostnameRegex # hostname ) \b }{$1}gix; # Turn HTTP URLs into links . . . $text =~ s{ \b # Capture the URL to $1 . . . ( http:// $HostnameRegex \b # hostname ( / [-a-z0-9_:\@&?=+,.!/~*'%\$]* # Optional path (?$1}gix; ----------------------------------------------------------------------------- Copyright 1997-2024 Jeffrey Friedl