use of io.atlasmap.spi.AtlasActionProcessor in project atlasmap by atlasmap.
the class StringComplexFieldActions method replaceAll.
/**
* Replaces all hits with the regular expression specified as a parameter.
* @param replaceAll action model
* @param input source
* @return processed
*/
@AtlasActionProcessor
public static String replaceAll(ReplaceAll replaceAll, String input) {
if (replaceAll == null || replaceAll.getMatch() == null || replaceAll.getMatch().isEmpty()) {
throw new IllegalArgumentException("ReplaceAll action must be specified with a non-empty old string");
}
String match = replaceAll.getMatch();
String newString = replaceAll.getNewString();
return input == null ? null : input.replaceAll(match, newString == null ? "" : newString);
}
Aggregations