The Wicket Framework has simple EmailAddressValidator that's been working fine for me so far. It uses the following regex, using the Pattern.CASE_INSENSITIVE flag in Pattern.compile:
You'll probably be fine with a simple validator, an address that doesn't validate with a simple validator and does with the RFC compliant validator is also likely to be a user mistake.
For people interested in a possibly, maybe, potentially correct regular expression to parse email addresses: Here's the code of some perl module that afaik is correct (but then I'd have no idea how to validate it, so I'm just repeating what other, hopefully more educated people have claimed):
发布评论
评论(3)
使用适用于 J2ME 的第三方正则表达式库。例如:regexp-me,或 dk.brics.automaton 使用可用于此目的的许多正则表达式之一对其进行验证(如 J2ME 中的正则表达式)。例如,验证电子邮件地址的最佳正则表达式是什么?中的内容。
或者使用问题答案中提出的代码片段: 是否有适用于 Java ME 或 BlackBerry 的电子邮件验证器代码?。
Wicket 框架有简单的EmailAddressValidator 到目前为止对我来说工作得很好。它使用以下正则表达式,并在
Pattern.compile
中使用Pattern.CASE_INSENSITIVE
标志:它还有一个 RFC-822 兼容验证器:RfcCompliantEmailAddressValidator。 这里是RFC-2822 兼容正则表达式。这似乎是电子邮件地址的最新规范。
您可能可以使用简单的验证器,但不使用简单验证器进行验证而使用符合 RFC 的验证器进行验证的地址也可能是用户错误。
Use a third-party regex library for J2ME. For instance: regexp-me, or dk.brics.automaton to validate it with one of the many regular expressions available out there for this purpose (as proposed in Regular expressions in J2ME). For instance, the ones in What is the best regular expression for validating email addresses?.
Or use the code snippet proposed in this answer to the question: Is there email validator code for Java ME or BlackBerry?.
The Wicket Framework has simple EmailAddressValidator that's been working fine for me so far. It uses the following regex, using the
Pattern.CASE_INSENSITIVE
flag inPattern.compile
:It also has an RFC-822 compliant validator: RfcCompliantEmailAddressValidator. And here is a RFC-2822 compliant regex. It seems that's the latest spec on email addresses.
You'll probably be fine with a simple validator, an address that doesn't validate with a simple validator and does with the RFC compliant validator is also likely to be a user mistake.
对于对可能正确的正则表达式来解析电子邮件地址感兴趣的人:这是一些 perl 模块的代码,据我所知是正确的(但我不知道如何验证它,所以我只是重复什么其他,希望受过更多教育的人声称):
准备好了吗?好的,我们开始吧:
For people interested in a possibly, maybe, potentially correct regular expression to parse email addresses: Here's the code of some perl module that afaik is correct (but then I'd have no idea how to validate it, so I'm just repeating what other, hopefully more educated people have claimed):
Ready? Ok here we go:
使用正则表达式。这是关于如何操作的博客文章它。来自博客文章:
由于您在 J2ME 平台上并且无法访问 Java 的正则表达式,因此您可以尝试名为 正则表达式-me。
Use a regex. Here's a blog post on how to do it. From the blogpost:
Since you're on the J2ME platrform and don't have access to Java's regular expressions, you can try the third party library called regexp-me.