1
我有正則表達式的問題。不知何故,在線regextester不符合該模式。春季驗證java模式多郵件
我想允許
[email protected]
和
[email protected];[email protected];[email protected]
這樣一個沒有分號,多用之間的分號,但不是最終
我有:
private static final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
public EmailValidator() {
pattern = Pattern.compile(EMAIL_PATTERN);
}
public boolean valid(final String email) {
matcher = pattern.matcher(email);
return matcher.matches();
}
THX,它工作正常,看起來不錯。 與測試: [email protected]:真\t \t [email protected]; [email protected]; [email protected]:真 \t \t [email protected]; [email protected]; mymail3 @ whatever.com;:false [email protected];:false – w3Charlie