On 9/28/04 6:08 AM, "Jesse Sng" <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> Does anyone have a handy regex for detecting and selecting a chunk of
> text that is a to be made into a URL or an email address?

Jesse, here's one for an email address (*really* watch for line breaks - I
put in hard returns and indents so it formats properly and is legible, but
you'll have to take them out):

function isEmail pWhat
  put matchText(pWhat,"[EMAIL PROTECTED]
     ([.][A-z0-9_\-]+)+[A-z]$") into tNotIP
  put matchText(pWhat,"^(\d{1,3})\.(\d{1,3})\.(\d{1,3})
      \.(\d{1,3})$") into tIsIP
  return (tIsIP or tNotIP)
  -- supports:
  --   periods in user address ([EMAIL PROTECTED])
  --   multiple subdomains ([EMAIL PROTECTED])
  --   new domains with more than 2 characters (.info, .museum, etc.)
  --   IP addresses
end isEmail

HTH,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: [EMAIL PROTECTED]


_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to