String matchScore =
"<span class=\"dddd\">P</span> 0 - 0 <span class=\"eeee\">P</span>";
Pattern p = Pattern.compile( "<[^>]+>([^<]*)</[^>]+>");
Matcher m = p.matcher(matchScore);
while(m.find()){
matchScore = matchScore.replaceFirst( "<[^>]+>([^<]*)</[^>]+>", m.group(1).toString());
}
System.out.println(matchScore);
Pattern p = Pattern.compile( "<[^>]+>([^<]*)</[^>]+>");
Matcher m = p.matcher(matchScore);
while(m.find()){
matchScore = matchScore.replaceFirst( "<[^>]+>([^<]*)</[^>]+>", m.group(1).toString());
}
System.out.println(matchScore);
http://www.stratulat.com/blog/jspjava-strip_tags-php-like-function
转载于:https://blog.51cto.com/xu20cn/124352