Thirteen jobs

Title: defining a regular expression string, it determines whether the input is determined whether the e-mail address for the e-mail.

package ass;
import java.util.*;
public class text6{

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        System.out.println("输入邮箱:");
        Scanner you = new Scanner(System.in);
        String a = you.next();
        String xiang = "\\w{0,}+[@]\\w+[.]\\w+";
    
        if(a.matches(xiang))
            System.out.println("是正确电子邮箱");
        
        the else 
            System.out.println ( "e-mail wrong" ); 
        
        
    } 

}

 

Guess you like

Origin www.cnblogs.com/shuang123/p/11922238.html