Java examples for java.util.regex:Match Number
contains Non Numeric Characters by regex
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static void main(String[] argv) throws Exception { String rawInput = "java2s.com"; System.out.println(containsNonNumericCharacters(rawInput)); }//from w w w . j av a 2 s .co m public static boolean containsNonNumericCharacters(String rawInput) { Pattern p = Pattern.compile("(\\D+)"); Matcher m = p.matcher(rawInput); return m.find(); } }