List of usage examples for java.util.regex Matcher replaceAll
public String replaceAll(Function<MatchResult, String> replacer)
From source file:org.esupportail.portlet.filemanager.services.uri.RegUriManipulateService.java
public String manipulate(String uri) { String outUri = ""; outUri = uri;//ww w.j a v a 2s. com // we check if the path is a regular expression if (regexp != null && replacement != null) { Pattern p = Pattern.compile(regexp, Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(outUri); outUri = m.replaceAll(replacement); } if (log.isDebugEnabled()) log.debug("RegUriManipulateService:: input uri :" + uri + " -- output uri : " + outUri); return outUri; }
From source file:com.kumarvv.setl.utils.Interpolator.java
String interpolate(final String str, final String key, final Object value) { if (StringUtils.isEmpty(str) || StringUtils.isEmpty(key)) { return str; }/*from w ww . jav a2 s . co m*/ String istr = str; Pattern p = Pattern.compile(key + "\\b"); Matcher m = p.matcher(istr); istr = m.replaceAll(toInterpolateValue(value)); return istr; }
From source file:com.victor.fishhub.service.ratioalgo.FishRatioImpl.java
private String createRatioKey(Date date, Time time) { String raw = "D" + date + "T" + time; Matcher matcher = PATTERN.matcher(raw); String key = matcher.replaceAll(""); return key;/*from w w w. ja va 2s.c o m*/ }
From source file:com.fujitsu.dc.core.rs.odata.AbstractODataResource.java
/** * null????????./*from w ww . j a v a 2s . co m*/ * @param value ? * @return */ public static String replaceNullToDummyKey(String value) { Pattern pattern = Pattern.compile("=null([,|\\)])"); Matcher m = pattern.matcher(value); return m.replaceAll("='" + DUMMY_KEY + "'$1"); }
From source file:net.jforum.core.events.post.BadWordEvent.java
private String applyFilter(String text, String replacement, Pattern pattern) { Matcher matcher = pattern.matcher(text); return matcher.replaceAll(replacement); }
From source file:org.obiba.onyx.engine.variable.export.OnyxDataPurgeReaderTest.java
public OnyxDataPurgeReaderTest() { String fullClassName = this.getClass().getCanonicalName(); Pattern p = Pattern.compile("\\."); Matcher m = p.matcher(fullClassName); testFileName = m.replaceAll("/") + ".xml"; }
From source file:org.obiba.onyx.engine.variable.export.OnyxDataExportReaderTest.java
public OnyxDataExportReaderTest() { String fullClassName = this.getClass().getCanonicalName(); Pattern p = Pattern.compile("\\."); Matcher m = p.matcher(fullClassName); testFileName = m.replaceAll("/") + ".xml"; }
From source file:org.brushingbits.jnap.common.seo.RegExpSeoStopWordCleaner.java
public String clean(String str) { if (WORD_CLEANER_REGEXP == null) { WORD_CLEANER_REGEXP = Pattern.compile( MessageFormat.format("\\b({0})\\b", StringUtils.join(getSeoStopWords(), '|')), Pattern.CASE_INSENSITIVE); }//from ww w. j ava2 s . c om Matcher unusefulWordsMatcher = WORD_CLEANER_REGEXP.matcher(str); return unusefulWordsMatcher.replaceAll(StringUtils.EMPTY); }
From source file:au.org.ala.delta.directives.AbstractFormattingDirective.java
protected String cleanWhiteSpace(String input) { Pattern p = Pattern.compile("(\\W)\\s(\\W)"); Matcher m = p.matcher(input); input = m.replaceAll("$1$2"); m = p.matcher(input);/* w w w . j a v a2 s. co m*/ input = m.replaceAll("$1$2"); p = Pattern.compile("(\\W)\\s(\\w)"); m = p.matcher(input); input = m.replaceAll("$1$2"); p = Pattern.compile("(\\w)\\s(\\W)"); m = p.matcher(input); input = m.replaceAll("$1$2"); return input; }
From source file:org.nuxeo.ecm.automation.client.rest.api.RestClient.java
private String replaceAutomationEndpoint(String url) { Matcher matcher = SITE_AUTOMATION_PATH_PATTERN_COMPILED.matcher(url); return matcher.replaceAll(API_PATH); }