#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0

    Regex mail extension


    Hi,
    sorry, this regex is correct to get any email with extension ".de". For example: dds-34@sad-343c,ewr.de, dsfds@ewr-rre3.de, 34df,ewr@45dsf,-ewtr.de, dsfds@sdfds345.de ecc..?
    Code:
    /^.@.\.[de]$/i
    Thanks a lot

    Bye
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,066
    Rep Power
    9398
    No.
    1. []s are character sets and match one of whatever characters you put inside. That expression requires the email to end with a "d" or "e".
    2. dot-all (.) matches just one character. Use a + after it to match one or more characters.
    Code:
    /^.+@.+\.de$/i
    Protip: your language may provide a better mechanism for validating an email address. Use that.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0
    Thank you, very precise and professional

    Bye

IMN logo majestic logo threadwatch logo seochat tools logo