Java examples for java.util.regex:Match Word
is Alpha by Regex
//package com.java2s; import java.util.regex.Pattern; public class Main { private static Pattern PATTERN_ALPHA = Pattern.compile("^[A-Za-z]+$"); public static boolean isAlpha(String alpha) { if (alpha == null) return false; else//w w w . j a va2 s.c o m return PATTERN_ALPHA.matcher(alpha).matches(); } }