Java examples for java.util.regex:Match Number
check Digit by Regex
//package com.java2s; import java.util.regex.Pattern; public class Main { public static boolean checkDigit(String digit) { String regex = "\\-?[1-9]\\d+"; return Pattern.matches(regex, digit); }/* w w w. j a va 2 s. c om*/ }