驗證 email格式是否正確

public class EmCheck {it

    public static void main(String[] args) {
        initview();
    }
    private static void initview() {
        String str=
                "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}"
                + "\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))"
                + "([a-z]{2,4}|[0-9]{1,3})(\\]?)$";
        String str2="123@qq.com";
        if (str2.matches(str)){
            System.out.println("yes");
        }else{
            System.out.println("no");
        }
    }class

}qq

相關文章
相關標籤/搜索