D
Doug
I'm a little confused by this functionality. It doesn't seem to be
behaving like it should.
I am using the following regular expression to validate email
addresses:
"\w+([-+.]\w+)*@\w+([-.]\w+)*\.([a-zA-Z]{2,4})\040*". From what I can
determine it should validate the following rules:
1. BEFORE THE AMPERSAND
A. Must contain at least one alphanumeric character.
B. Can contain a '-', '+', or '.' character but if it does it
must have a alphanumeric character on either side of it.
2. AFTER THE AMPERSAND BUT BEFORE THE '.'
A. Must contain at least one alphanumeric character.
B. Can contain a '-', or '.' character but if it does it must
have a alphanumeric character on either side of it.
3. AFTER THE '.'
A. Must contain at least two alphabetical characters but no more
than 4.
However when I use System.Text.RegularExpressions.RegEx with this
expression and use the IsMatch method and use an email address like
(e-mail address removed)@[email protected] it returns true as if that was
a valid email address based on the rules.
Doesn't the {2,4} mean that it has to have a minimum of 2 characters
after the '.' character but no more than 4? Also, doesn't the
[a-zA-Z] mean that the characters after the '.' must be alphabetical
only? My tests seem to prove otherwise.
Any help on this would be great...thanks!
behaving like it should.
I am using the following regular expression to validate email
addresses:
"\w+([-+.]\w+)*@\w+([-.]\w+)*\.([a-zA-Z]{2,4})\040*". From what I can
determine it should validate the following rules:
1. BEFORE THE AMPERSAND
A. Must contain at least one alphanumeric character.
B. Can contain a '-', '+', or '.' character but if it does it
must have a alphanumeric character on either side of it.
2. AFTER THE AMPERSAND BUT BEFORE THE '.'
A. Must contain at least one alphanumeric character.
B. Can contain a '-', or '.' character but if it does it must
have a alphanumeric character on either side of it.
3. AFTER THE '.'
A. Must contain at least two alphabetical characters but no more
than 4.
However when I use System.Text.RegularExpressions.RegEx with this
expression and use the IsMatch method and use an email address like
(e-mail address removed)@[email protected] it returns true as if that was
a valid email address based on the rules.
Doesn't the {2,4} mean that it has to have a minimum of 2 characters
after the '.' character but no more than 4? Also, doesn't the
[a-zA-Z] mean that the characters after the '.' must be alphabetical
only? My tests seem to prove otherwise.
Any help on this would be great...thanks!