class RegEx extends AbstractMapper {

	@Override
	public String transform (String attrValue) {
		String result = attrValue;
		try {
			if (replacementPattern != null && !replacementPattern.isEmpty()) {
				for (String matchPattern : replacementPattern.keySet()) {
					Pattern p = Pattern.compile(matchPattern);
					Matcher m = p.matcher(result);
					if (m.find()) {
						String replacement = replacementPattern.get(matchPattern);
						if (replacement != null) {
							result = m.replaceAll(replacement);
						}
					}
				}
			}
		} catch (Throwable t) {
			logger.error("Failed to transform " + attrValue, t.fillInStackTrace());
		}
		return result;
	}

}