Copied from a tivo support filed tonight… (id: 140212-018933)


While trying to reset my account password tonight I notice that the page:

attempts to validate the input email address, for example mine:

This validation fails, the regular expression match your site attempts is:

for the input field:
<input type="text" name="newEmail">

This regular expression does not take into account the fact (at least) that ‘-’ is a valid character for domain names on the internet. here’s an example of attempting to validate using your regular expression with python’s regular expression library:
>>> import re
>>> re.match(’^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9]+\.)+[A-Za-z]{2,4}$’, ‘’)

note that the email address above is valid, but your regex fails to see this fact. Now, remove the ‘-’ from the domain and:
>>> re.match(’^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9]+\.)+[A-Za-z]{2,4}$’, ‘’)
<_sre.SRE_Match object at 0x10e4168>

see, a match is found. The right regular expression is likely:
>>> re.match(’^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,4}$’, ‘’)
<_sre.SRE_Match object at 0x10e41d0>
>>> re.match(’^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,4}$’, ‘’)
<_sre.SRE_Match object at 0x10e4168>

Note that my regex change permits the ‘-’ and works for both versions of my domain name. I hope you’ll fix this so other customers won’t be befuddled and have to take time with customer support on the phone.


Note that I had to spend a significant amount of time on the phone with tivo ‘technical support’ for the support individual to tell me:
1) he has to reset so many customer’s passwords by hand because the website doesn’t work right
2) that he clearly didn’t understand the actual problem
3) make me sad…

email validation is ‘hard’... only it REALLY ISN’T!