Java tutorial
//package com.java2s; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static final Map<Pattern, Integer> emoticons = new HashMap<Pattern, Integer>(); public static boolean containsKey(String key) { boolean b = false; for (Map.Entry<Pattern, Integer> entry : emoticons.entrySet()) { Matcher matcher = entry.getKey().matcher(key); if (matcher.find()) { b = true; break; } } return b; } }