public class RegexConversion extends java.lang.Object implements Conversion<java.lang.String,java.lang.String>
revert(String)
implements the same behavior of execute(String)
. Null inputs produce null outputs.Modifier and Type | Field and Description |
---|---|
private java.lang.String |
replacement |
private java.lang.String |
replaceRegex |
Constructor and Description |
---|
RegexConversion(java.lang.String replaceRegex,
java.lang.String replacement)
Creates a conversion that matches contents identified by the given regular expression and replaces them by the given replacement String.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
execute(java.lang.String input)
Executes the regular expression provided in the constructor of this class against the input and replaces any matched content with the replacement String.
|
java.lang.String |
revert(java.lang.String input)
Executes the regular expression provided in the constructor of this class against the input and replaces any matched content with the replacement String.
|
private final java.lang.String replaceRegex
private final java.lang.String replacement
public RegexConversion(java.lang.String replaceRegex, java.lang.String replacement)
replaceRegex
- the regular expression used to match contents of a given input Stringreplacement
- the replacement content to replace any contents matched by the given regular expressionpublic java.lang.String execute(java.lang.String input)
revert(String)
execute
in interface Conversion<java.lang.String,java.lang.String>
input
- The input to have contents matched by the regular expression and replacedpublic java.lang.String revert(java.lang.String input)
execute(String)
revert
in interface Conversion<java.lang.String,java.lang.String>
input
- The input to have contents matched by the regular expression and replaced