Java tutorial
//package com.java2s; //License from project: Apache License public class Main { public static boolean hasOnlyCharAndNumbers(String text) { String ePattern = "^[a-zA-Z0-9]+$"; java.util.regex.Pattern p = java.util.regex.Pattern.compile(ePattern); java.util.regex.Matcher m = p.matcher(text); return m.matches(); } }