×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Xojo
Posted by: Radium Kymist
Added: Feb 7, 2015 1:04 PM
Views: 34
Tags: email
by simulanics

Check to see if an email address is valid.
  1. //CheckIfEmailIsValid
  2. //emailAddress as string
  3. //Return Type Boolean
  4.  
  5.   Dim re As RegEx
  6.   re = New RegEx
  7.   Dim rm As RegExMatch
  8.  
  9.   If  emailAddress="" then
  10.     Return True
  11.   else
  12.    
  13.     re.SearchPattern = "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?"
  14.     rm = re.Search(emailAddress)
  15.    
  16.     if rm = Nil Then
  17.       Return False
  18.     Else
  19.       Return True
  20.     End if
  21.   end if