62,569
社区成员




public static void main(String[] s)
{
StringBuilder sb = new StringBuilder("<font face=\"Arial,Serif\" size=\"+2\" color=\"red\">");
Pattern p = Pattern.compile("<\\s*\\w+(\\s+([\\w]+\\s*)=\"([^\"]*)\")*?\\s*>");
Matcher m = p.matcher(sb.toString());
while(m.find())
{
if(m.group(2) == null || m.group(3) == null)
break;
System.out.print(m.group(2)+" ");
System.out.println(m.group(3));
int start = sb.indexOf(m.group(1));
int end = start + m.group(1).length();
sb.delete(start, end);
m = p.matcher(sb.toString());
}
}
public static void main(String[] args) {
String str="<font face=\"Arial,Serif\" size=\"+2\" color=\"red\">";
for(String s :str.split("[\\s<>\\\"&&[^=\\\"]]")){
if(s.contains("=")){
s = s.replaceFirst("=\\\"", " ");
s = s.substring(0, s.length()-1);
System.out.println(s);
}
}
}