public static String removeCrossReference(String text){
  if (Strings.isNullOrEmpty(text)) {
    return "";
  }
  Pattern pattern=Pattern.compile("\\[(?<name>[^\\]]+?)\\]( |\\n)*" + "\\[(?<link>[^\\]]*?)\\]");
  Matcher matcher=pattern.matcher(text);
  StringBuffer result=new StringBuffer();
  while (matcher.find()) {
    String replacementText=matcher.group("name");
    replacementText=Matcher.quoteReplacement(replacementText);
    matcher.appendReplacement(result,replacementText);
  }
  matcher.appendTail(result);
  return result.toString();
}

public static String removeCrossReference ( String text ) { if ( Strings . isNullOrEmpty ( text ) ) { return "" ; } Pattern pattern = Pattern . compile ( "\\[(?<name>[^\\]]+?)\\]( |\\n)*" + "\\[(?<link>[^\\]]*?)\\]" ) ; Matcher matcher = pattern . matcher ( text ) ; StringBuffer result = new StringBuffer ( ) ; while ( matcher . find ( ) ) { String replacementText = matcher . group ( "name" ) ; replacementText = Matcher . quoteReplacement ( replacementText ) ; matcher . appendReplacement ( result , replacementText ) ; } matcher . appendTail ( result ) ; return result . toString ( ) ; }
given a documentation string , replace the cross reference links with reference text .
