java strip_tags 去除html标签

  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);

 

 

http://www.stratulat.com/blog/jspjava-strip_tags-php-like-function

 

 

你可能感兴趣的:(java,职场,休闲,strip_tags,去除html标签)