Yalo
    e-mail
    internet accelerators
    internet access
    internet and phone call
    web hosting
    storage space
    url redirection
    internet call waiting
    free sms
    nota bene
 
 

Regular expressions to validate domain names, email addresses

  • Regex to validate domain names.

    Permitted characters are letters, digits, hyphen, dot. Domain name must begin and end with a letter or digit and may have interior hyphens. Domain name may contain subdomains. Permitted TLD length is 2 to 4.

     ^([a-z0-9]+(\-*[a-z0-9]+)*\.)*([a-z0-9]+(\-*[a-z0-9]+)*)+(\.[a-z]{2,4})$ 
  • Regex to validate local part of email addresses.

    Permitted characters are letters, digits and . ~ ! $ ^ & * + = _ -
    Local part must not begin or end with a dot, must not contain two or more dots consecutively.

     ^[a-z0-9~!\$^&*+=_-]+(\.[a-z0-9~!\$^&*+=_-]+)*$ 
  • Regex to validate full email addresses, based on previous two regex.
    ^[a-z0-9~!\$^&*+=_-]+(\.[a-z0-9~!\$^&*+=_-]+)*@([a-z0-9]+(\-*[a-z0-9]+)*\.)*([a-z0-9]+(\-*[a-z0-9]+)*)+(\.[a-z]{2,4})$