Re: Email Validation for multiple emails (comma separated)



On May 30, 3:04 pm, Georgi Naumov <gonau...@xxxxxxxxx> wrote:
You can try to use the following regular expression:
/^[A-Z0-9\._%-]+@[A-Z0-9\.-]+\.[A-Z]{2,4}(?:(?:[,;][A-Z0-9\._%-]+@[A-
Z0-9\.-]+))?$/i
I not tested it but hope to work good for you.
P.P:
Sorry for my bad english.
Good Luck !
ll :

Hi,
I currently am using the following regex in js for email validation,
in which the email addresses can be separated by commas or
semicolons. The problem, however, lies in that I can type two emails
(as a run-on, with no comma or semicolon), and as long as it ends in a
three character domain, it is accepted as valid.

I wonder if there would be a way to make the comma or semicolon
mandatory if a second email address existed?
Many thanks for any help - Louis

Here is the script:

function checkEmailForErrors (Form,Field) {
var emailFilter2=/(([a-zA-Z0-9\-?\.?]+)@(([a-zA-Z0-9\-_]+\.)+)([a-z]
{2,3})(\W?[,;]\W?(?!$))?)+$/i;
var emailValue2=eval("document."+Form+"."+Field+".value");
if (!(emailFilter2.test(emailValue2))) {
return false;
}else{
return true;
}
}


Thanks very much for this - I am experimenting with it and will keep
you posted!
Regards,
Louis

.



Relevant Pages

  • Re: Email Validation for multiple emails (comma separated)
    ... I currently am using the following regex in js for email validation, ... in which the email addresses can be separated by commas or ... semicolons. ...
    (comp.lang.javascript)
  • Re: Which or that
    ... of contemporary written and spoken English and they quite clearly point ... When do you use commas or not? ... I'll be happy if you can provide me with a single acceptable example in a modern English text where a relative clause introduced by "that" is enclosed in commas - by saying "acceptable" I mean I'd like to exclude any examples where the author clearly doesn't understand the proper usage of commas. ... One final general comment - a lot of heat is generated in many of these discussions where questions of style are confused with questions of grammar. ...
    (uk.culture.language.english)
  • Proper usage of "however"
    ... Should the subtitle be "The "war of commas, 'but', semicolons, and ... Perhaps someone can refer me to a definitive URL? ... but I find this usage weak and will usually avoid semicolons on ... Embedding "however" in the middle of a ...
    (alt.usage.english)
  • Re: SCWC 41: comments
    ... Note that "first" occurs only in the context of "principal, ... (separated by commas, not semicolons - see ... have contained other forms of words (separated by commas), ... parsing its punctuation to maintain a specious position is taking ...
    (rec.puzzles.crosswords)
  • Re: regex: find semicolon that is not part of an entity
    ... I answered my own question moments ... The regex you provided, and which I modified, ... character class it finds the semicolons in entities before the regex has ... splitting a String on semicolons, ...
    (comp.lang.java.programmer)