[TYPO3-core] RFC: #11201: Feature: add eval email

Christian Kuhn lolli at schwarzbu.ch
Sun May 31 19:59:09 CEST 2009


Hey,

Mathias Schreiber [wmdb >] wrote:
>> Johannes Feustel schrieb:
>>> evalFunc_email doesn't test if a tld exists. Why not using RegExp like
>>> /^([\w]+)(\.[\w]+)*@([\w\-]+\.){1,5}([A-Za-z]){2,4}$/;
>>> (copied from ExtJS) or using ExtJS validation directly?

>> i didn't want to run in same problems we had before in php with reg 
>> exp., so JS-test is very simple:
>> does @ exist, does . exist, don't start with @, don't end with .

Ending with . is accepted by js check.


>> The deeper validation is done php-side.

We should still consider using a better regex here. Some good arguments
and examples can be found in [1].

In a perfect world we should imho have the exact same validation in js
as in the php filter [2]. This is why I am unsure if I should +1 your
current solution. I tend to say: Either have a 99,99% solution in js or
none at all, just checking an @ and a dot is not enough, and it leads to
two different error cases:
If js doesn't validate it just resets the field to an empty string, and
if js accepts, but php doesn't, then the new value won't be stored and
the old one will be displayed. This is suboptimal from a users point of
view. Php and js congruent in both behavior and validation would be better.


> I like the idea, the docs should clearly state that the validation is 
> rather basic and that email like huselpusel at 192.168.13.13 aren't covered 
> by this.

I think huselpusel at 192.168.13.13 is actually a valid email address,
right? It's currently accepted both by js and php filter.



Regards
Christian



[1] http://www.regular-expressions.info/email.html

[2] Regex in php 5.2.9 (file ext/filter/logical_filters.c)
"/^((\\\"[^\\\"\\f\\n\\r\\t\\b]+\\\")|([\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]+(\\.[\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\~\\/\\^\\`\\|\\{\\}]*)*))@((\\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9])(([A-Za-z0-9\\-])*([A-Za-z0-9]))?\\.?)+[A-Za-z\\-]*))$/D"


More information about the TYPO3-team-core mailing list