Class RegexConversion
- java.lang.Object
-
- com.univocity.parsers.conversions.RegexConversion
-
- All Implemented Interfaces:
Conversion<java.lang.String,java.lang.String>
public class RegexConversion extends java.lang.Object implements Conversion<java.lang.String,java.lang.String>
Replaces contents of a given input String, identified by a regular expression, with a replacement String. Therevert(String)implements the same behavior ofexecute(String). Null inputs produce null outputs.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringreplacementprivate java.lang.StringreplaceRegex
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringexecute(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.Stringrevert(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.
-
-
-
Constructor Detail
-
RegexConversion
public 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.- Parameters:
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 expression
-
-
Method Detail
-
execute
public 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. Equivalent torevert(String)- Specified by:
executein interfaceConversion<java.lang.String,java.lang.String>- Parameters:
input- The input to have contents matched by the regular expression and replaced- Returns:
- The String resulting from the content replacement
-
revert
public 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. Equivalent toexecute(String)- Specified by:
revertin interfaceConversion<java.lang.String,java.lang.String>- Parameters:
input- The input to have contents matched by the regular expression and replaced- Returns:
- The String resulting from the content replacement
-
-