JS: email regexp w/ONLY one period possible before @
A period can occur before the @, but not twice in a row -- as in firstname.lastname@example.org but not jane..email@example.com.
Email must start with a letter.
I'm also allowing underscores and hyphens before the @, but I'm not worrying about whether there's only one of each -- I'm just allowing those.
I have read extensively on this site and several others and haven't found a solution to the "one and only one period allowed in succession, but not required" problem. I haven't found a successful way to limit periods to only 1 in a row yet still have the rest of the validation work properly.
I get the symbols in general, but as a newbie can't seem to make them do this one thing that I want them to do. Thanks for any help that's going!
Hmmm...I think that Lorna's needs are even simpler than what Philip gave.
var reEmail = /^[a-z](\.?[\w\-\])*\@([\w\-]+\.)+(com|net|org)$/i;
Now, that *does* allow an address of firstname.lastname@example.org
and does not allow
The former being somewhat short but legal. The latter, though, probably being properly rejected (though not called for in the spec, above).
Basically, that says:
start with a letter
accept zero or more occurrences of an optional period followed by letter/digit/dash/underline
accept one or more occurrences of ( (one or more letter/digit/dash/underline) followed by period )
accept com or net or org
So how is yours significantly different, except slightly shorter by using \w?
Lorna's thread title says "only one . possible before the @" but she then goes on to say "A period can occur before the @, but not twice in a row". I have interpreted this contradiction to mean two consecutive periods not allowed, as of course email@example.com is perfectly legal.
But in any case Lorna does not seem to be impressed by the ability of either of us to meet her needs. She probably thinks we are too old.
Don't waste your money on ineffective and possibly dangerous pumps, exercises and surgeries.