public static String cleanText(String text){
  String plainText=text;
  plainText=plainText.replaceAll("<.+?>"," ");
  plainText=plainText.replaceAll("__.+?__"," ");
  plainText=plainText.replaceAll("\\[http.+?\\]"," ");
  plainText=plainText.replaceAll("\\{\\|.+?\\|\\}"," ");
  plainText=plainText.replaceAll("\\{\\{.+?\\}\\}"," ");
  plainText=plainText.replaceAll(" - "," ");
  plainText=plainText.replace('"',' ');
  plainText=plainText.replace('\'',' ');
  plainText=plainText.replace('[',' ');
  plainText=plainText.replace(']',' ');
  plainText=plainText.replace('=',' ');
  plainText=plainText.replace('*',' ');
  plainText=plainText.replace('|',' ');
  plainText=plainText.replace(':',' ');
  plainText=plainText.replace('{',' ');
  plainText=plainText.replace('}',' ');
  plainText=plainText.replace('(',' ');
  plainText=plainText.replace(')',' ');
  plainText=plainText.replaceAll("\\s{2,}"," ");
  return plainText;
}

public static String cleanText ( String text ) { String plainText = text ; plainText = plainText . replaceAll ( "<.+?>" , " " ) ; plainText = plainText . replaceAll ( "__.+?__" , " " ) ; plainText = plainText . replaceAll ( "\\[http.+?\\]" , " " ) ; plainText = plainText . replaceAll ( "\\{\\|.+?\\|\\}" , " " ) ; plainText = plainText . replaceAll ( "\\{\\{.+?\\}\\}" , " " ) ; plainText = plainText . replaceAll ( " - " , " " ) ; plainText = plainText . replace ( '"' , ' ' ) ; plainText = plainText . replace ( '\'' , ' ' ) ; plainText = plainText . replace ( '[' , ' ' ) ; plainText = plainText . replace ( ']' , ' ' ) ; plainText = plainText . replace ( '=' , ' ' ) ; plainText = plainText . replace ( '*' , ' ' ) ; plainText = plainText . replace ( '|' , ' ' ) ; plainText = plainText . replace ( ':' , ' ' ) ; plainText = plainText . replace ( '{' , ' ' ) ; plainText = plainText . replace ( '}' , ' ' ) ; plainText = plainText . replace ( '(' , ' ' ) ; plainText = plainText . replace ( ')' , ' ' ) ; plainText = plainText . replaceAll ( "\\s{2,}" , " " ) ; return plainText ; }
clean a string from left - over wikimarkup ( most parsers do not work 100 % correct ) .
