Javascript multiple email validation REGEX

Discussion in 'JavaScript' started by varunkrish, Nov 26, 2008.

  1. #1
    i am currently using this regex to validate email address using javascript

    /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/

    now i want to allow users to enter multiple email addresses seperated by comma or semicolon

    so i made the javascript this way

    /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})(?:[,;]([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})*$/i;

    But it does not seem to work..

    can anyone tell me whts wrong

    thanks
     
    varunkrish, Nov 26, 2008 IP