Java tutorial
//package com.java2s; public class Main { public static boolean isIDCard(String IDStr) { String regx = "\\d{15}|\\d{17}[\\dXx]"; return IDStr.matches(regx); } }