Java examples for Regular Expressions:Pattern
Let the pattern include uppercase letters as well as lowercase letters
import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static void main(String[] args) { Pattern pattern = Pattern.compile("b[aAeEiIoOuU]t"); Matcher matcher = pattern.matcher("bAt"); if (matcher.matches()) System.out.println("Match."); else/*from w ww . j a va2s . c om*/ System.out.println("Does not match."); } }