문제

I have two interacting systems in one we are using Castle Validator for our validation, the other is coded by hand, I need to ensure the email validation between these two systems is a match; the problem is I have not been able to find documentation of the Regex that castle uses for email.

There is this question but the links provided are all dead.

도움이 되었습니까?

해결책

After looking through the repo history I was able to find the regex (separated into multiple lines for readability):

^([a-zA-z0-9_\-\.\'\+]+)
@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))
([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$

A side note: this regex is still pretty broken with how the @[ipaddress] is allowed.

For example this: johndoe@mydomain.111] is registered as valid as would this: johndoe@[111.111.111.com

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top