### Question:
SimpleRegexReplacer implements StandardizationPolicy { @Override public String convertValue(String value) { if (!valid) { return value; } if(replacement== null){ replacement = ""; } return pattern.matcher(value).replaceAll(replacement); } SimpleRegexReplacer(@PolicyPropertyRef(name = "Regex Pattern") String regex,
                               @PolicyPropertyRef(name = "Replacement") String replace); @Override String convertValue(String value); Pattern getPattern(); String getReplacement(); boolean isValid(); Boolean accepts(Object value); Object convertRawValue(Object value);  }### Answer:
@Test public void testConversions() throws Exception { SimpleRegexReplacer regexReplacer = new SimpleRegexReplacer("(?i)foo", "bar"); assertEquals("barfeebarfie", regexReplacer.convertValue("foofeefoofie")); assertEquals("", regexReplacer.convertValue("")); assertEquals("barfeebarfie", regexReplacer.convertValue("barfeebarfie")); SimpleRegexReplacer regexReplacer2 = new SimpleRegexReplacer("N/A", null); assertEquals("", regexReplacer2.convertValue("N/A")); SimpleRegexReplacer regexReplacer3 = new SimpleRegexReplacer("N/A", ""); assertEquals("", regexReplacer3.convertValue("N/A")); }
@Test public void testSpaces() throws Exception { SimpleRegexReplacer regexReplacer = new SimpleRegexReplacer("\\s", ""); assertEquals("", regexReplacer.convertValue(" ")); }