Home All Groups Group Topic Archive Search About
Author
8 Mar 2005 3:30 PM
anonymous
The following expression I am using to validate an email.
However when empty spaces entered at the end of email it
is recognized as invalid email. How do I fix this problem?
^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*
[0-9a-zA-Z])*\.)+[a-zA-Z]
{2,9})$

Author
8 Mar 2005 4:49 PM
Paul D. Fox
Here's an easier method....
Just go to http://regexlib.com/ and lookup "e-mail validation" and copy one
of the expressions already written there.

Paul

Show quoteHide quote
"anonymous" <anonym***@discussions.microsoft.com> wrote in message
news:5bb901c523f3$bff31090$a401280a@phx.gbl...
> The following expression I am using to validate an email.
> However when empty spaces entered at the end of email it
> is recognized as invalid email. How do I fix this problem?
> ^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*
> [0-9a-zA-Z])*\.)+[a-zA-Z]
> {2,9})$
Author
9 Mar 2005 2:03 PM
anonymous
I could not find any expression which will validate email
liek this:
<em***@msn.com  >.
As you can see I have some empty spaces after actual email
and I can't find the expression to validate email as well
as taking the space out.
Thanks
Author
9 Mar 2005 2:51 PM
JohnFol
You could always do a trim on the email field

Show quoteHide quote
"anonymous" <anonym***@discussions.microsoft.com> wrote in message
news:5bb901c523f3$bff31090$a401280a@phx.gbl...
> The following expression I am using to validate an email.
> However when empty spaces entered at the end of email it
> is recognized as invalid email. How do I fix this problem?
> ^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*
> [0-9a-zA-Z])*\.)+[a-zA-Z]
> {2,9})$
Author
9 Mar 2005 4:20 PM
anonymous
I am a little bit confused...here is my code... where I
should trim???
    <asp:RegularExpressionValidator id="reEmail"
runat="server" CssClass="error_message" ErrorMessage="You
must enter a valid Email address."

    ControlToValidate="txtEmailAddress"
ValidationExpression="^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@
(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})
$"></asp:RegularExpressionValidator>