现在我正在使用这个正则表达式:
^\A([a-z0-9\.\-_\+]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z$
我认为这不是很好.那么你在验证jids时所拥有或已经看过的最佳正则表达式是什么?
作为参考,Section 3 of the XMPP core standard在Augmented Backus-Naur Form中定义了一个JID作为参考
jid = [ node "@" ] domain [ "/" resource ] domain = fqdn / address-literal fqdn = (sub-domain 1*("." sub-domain)) sub-domain = (internationalized domain label) address-literal = IPv4address / IPv6address