Results 1 to 5 of 5

Thread: Regular Expression for email validation

  1. #1
    Frenzied Member
    Join Date
    Sep 06
    Location
    Scotland
    Posts
    1,054

    Regular Expression for email validation

    Unfortunately regular expressions are something I know nothing about.

    I am trying to validate an email address using javascript and this is what I am using:

    var expression = /^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/;

    However this doesn't allow for someone to use a filter on a gmail address e.g.

    myemail+filter@gmail.com

    Can anyone help me with finding an expression that will allow me to do this?

    Thanks.

  2. #2
    Web developer Nightwalker83's Avatar
    Join Date
    Dec 01
    Location
    Adelaide, Australia
    Posts
    9,731

    Re: Regular Expression for email validation

    I have the same problem. Are you looking at it from a framework point of view (say asp.net)?
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    Please consider giving me some rep points if I help you a lot.
    DON'T BUMP YOUR POSTS!!! Links to my code examples can now be found on my website: My websites
    Please rate my post if you find it helpful!
    Technology is a dangerous thing in the hands of an idiot! I am that idiot.

  3. #3
    Frenzied Member
    Join Date
    Sep 06
    Location
    Scotland
    Posts
    1,054

    Re: Regular Expression for email validation

    I'm not quite sure what you mean but I am using this for a client side validation of an email address on a web page using javascript. The server side validation will be the same but using php.

  4. #4
    Web developer Nightwalker83's Avatar
    Join Date
    Dec 01
    Location
    Adelaide, Australia
    Posts
    9,731

    Re: Regular Expression for email validation

    I found this in the VB.NET codebank.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    Please consider giving me some rep points if I help you a lot.
    DON'T BUMP YOUR POSTS!!! Links to my code examples can now be found on my website: My websites
    Please rate my post if you find it helpful!
    Technology is a dangerous thing in the hands of an idiot! I am that idiot.

  5. #5
    Frenzied Member
    Join Date
    Sep 06
    Location
    Scotland
    Posts
    1,054

    Re: Regular Expression for email validation

    As I said before, I am no expert, however it seems to me that that one still does not allow a plus, and unless I am mistaken it also only allows the address to have 2 sub domains?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •