Java tutorial
//package com.java2s; //License from project: Creative Commons License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static final Pattern pattern = Pattern.compile("(&\\w+;)"); public static boolean containsEncodedText(String text) { Matcher matcher = pattern.matcher(text); int count = 0; while (matcher.find()) { count++; } return count > 0; } }