|
![]() |
名片设计 CorelDRAW Illustrator AuotoCAD Painter 其他软件 Photoshop Fireworks Flash |
|
import java.sql.*; import java.io.*; import java.util.regex.*; public class test{ public static void main(String[] args){ try{ String s = ""; while(!s.equals("q")){ System.out.print("input:"); DataInputStream in = new DataInputStream(new BufferedInputStream(System.in)); s = in.readLine(); System.out.println("your input is :"+s); String check = "^([a-z0-9A-Z]+[-|//.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?//.)+[a-zA-Z]{2,}$"; Pattern regex = Pattern.compile(check); Matcher matcher = regex.matcher(s); boolean isMatched = matcher.matches(); if(isMatched){ System.out.println("it\\\'s a email"); }else{ System.out.println("it\\\'s not a email"); } } }catch(Exception e){ System.out.println("error"+e.getMessage()); } } } 返回类别: 教程 上一教程: [学习笔记]Thinking in Java (the 2nd edition) Study Note (3) 下一教程: JAVA 的MD5加密算法源代码 您可以阅读与"用java实现简朴的email正则表达式判定"相关的教程: · JAVA与正则表达式(2年级之1) · 在JAVA中使用正则表达式 · Java 正则表达式自义bean · JavaScript正则表达式 · 用正则表达式判定一个简朴的用户登陆的例子 |
![]() ![]() |
快精灵印艺坊 版权所有 |
首页![]() ![]() ![]() ![]() ![]() ![]() ![]() |