//很好的正则表达式教程
package com.huowolf;
import java.util.Scanner;
public class Demo8 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = null;
while(true) {
s=sc.nextLine();
System.out.println(IsHTML(s));
}
}
public static boolean IsHTML(String s) {
String reg = ").+?\\1||]+?(\\s\\w+?=.+?)*/>";
return s.matches(reg);
}
}
自己码的,如果不对请指出来。
原文:http://blog.youkuaiyun.com/huolang_vip/article/details/41727741