List of usage examples for java.lang String replaceAll
public String replaceAll(String regex, String replacement)
From source file:Main.java
public static String delHtml(String str) { String info = str.replaceAll("\\&[a-zA-Z]{1,10};", "").replaceAll("<[^>]*>", ""); info = info.replaceAll("[(/>)<]", ""); return info;//ww w . jav a 2s . c o m }
From source file:Main.java
public static String dirtilyAddNamespaceWithPrefixForOracleESB(String rootElement, String xmlDoc) { xmlDoc = xmlDoc.replaceAll("<" + rootElement, "<" + "ns2:" + rootElement + " " + "xmlns:ns2=\"http://www.oracle.com/esb\""); xmlDoc = xmlDoc.replaceAll("</" + rootElement, "</" + "ns2:" + rootElement); return xmlDoc; }
From source file:Main.java
private static String hackPhrase(String phrase) { phrase = phrase.replaceAll(" wiki(pedia)?$", ""); phrase = phrase.replaceAll("^(type|name) of ", ""); phrase = phrase.replaceAll(" (episodes?) (season \\d+)$", " $1 of $2"); return phrase; }
From source file:Main.java
public static String addTextHighlighting(final String string) { return string.replaceAll("<mark>", "<b>").replaceAll("</mark>", "</b>").replaceAll("[<](/)?img[^>]*", ""); }
From source file:Main.java
public static String EncodeToUrl(String url) { url = url.replaceAll("%3F", "?"); url = url.replaceAll("%3D", "="); url = url.replaceAll("%26", "&"); url = url.replaceAll("%3A", ":"); url = url.replaceAll("%2F", "/"); url = url.replaceAll("%40", "@"); return url;//from w ww . j a v a2 s .c o m }
From source file:Main.java
private static String esc(String str) { return str.replaceAll(":", "&&&").replaceAll("\\[", "&!&").replaceAll("\\]", "!&!").replaceAll(",", "!!!") .replaceAll("\\{", "!!&").replaceAll("\\}", "&&!").replaceAll("@", "###"); }
From source file:Main.java
public static String encodeReservedHTMLChars(String text) { String ret = text; ret = ret.replaceAll("&", "&"); ret = ret.replaceAll(">", ">"); ret = ret.replaceAll("<", "<"); return ret;//from w w w. j av a 2 s . c om }
From source file:Main.java
public static String getSanitizedName(final String fileName) { return fileName.replaceAll("[^\\w]", "_").replaceAll("[_]{2,}", "_"); }
From source file:Main.java
public static String tranLowCase(String str) { String string = str.replaceAll(" ", ""); return string.toLowerCase(); }
From source file:Main.java
public static int getWordsCount(String line) { String text = line.replaceAll("[?!,.]", ""); String[] words = text.split("\\s"); return words.length; }