"test<[email protected]>".matches("[.+]?<(.+?)>")主要看这样的格式邮件地址test<[email protected]>如何匹配这个杨的邮件地址是否有<>?

解决方案 »

  1.   

    public class TestEmail {
    public static void main (String args[]){
    String email = "test <[email protected]>";
    boolean yesOrNo = email.matches("\\w+\\s<.+>");

    System.out.print(yesOrNo);
    }
    }
    true肯定有别的更好的正则表达式  我这个应该也行
      

  2.   

    String email_regexp = "(?:\\w[-._\\w]*\\w@\\w[-._\\w]*\\w\\.\\w{2,3}$)"
      

  3.   

         * 格式: [email protected]   
         *   
         * 匹配 : [email protected] 或 [email protected] 
         *   
         * 不匹配: foo@bar 或 [email protected]   
      

  4.   

    indexOf("<")!=-1
    indexOf(">")!=-1