question: private static String wikiToPlainText ( String content ) { content = content . replaceAll ( "\\[\\[[iI]mage:[^\\]]*\\]\\]" , "" ) ; content = content . replaceAll ( "(?s)<!--.*?-->" , "" ) ; content = content . replaceAll ( "(?s)<ref>.*?</ref>" , "" ) ; content = content . replaceAll ( "(?s)\\{\\{([^{}]*?\\{\\{[^{}]*?\\}\\})+[^{}].*?\\}\\}" , "" ) ; content = content . replaceAll ( "(?s)\\{\\{.*?\\}\\}" , "" ) ; content = content . replaceAll ( "(?s)\\{\\|.*?\\|\\}" , "" ) ; content = content . replaceAll ( "\\[\\[[^\\]]*\\|" , "" ) ; content = content . replaceAll ( "\\[\\[" , "" ) ; content = content . replaceAll ( "\\]\\]" , "" ) ; content = content . replaceAll ( "(?s)<.*?>" , "" ) ; content = content . trim ( ) ; final int size = content . length ( ) ; int endOfFirstParagraph = content . indexOf ( "\n" , 50 ) ; if ( endOfFirstParagraph < 0 ) { endOfFirstParagraph = size ; } content = content . substring ( 0 , Math . min ( endOfFirstParagraph , 1024 ) ) ; return content ; }
target:  Extract plain text from Wikipedia article content.