去除 A 标签, 和 img 标签
public class TestString { public static void main(String[] args) { String s = "<a href=hjkhkhhk>daafadfafdadfa</a></a><img src='dsafasdfa'/>"; s=s.replaceAll("<a href[^>]*>", "yq1012"); s=s.replaceAll("</a>", "yq1012"); s=s.replaceAll("<img[^>]*/>", " img"); System.out.println(s); } }