Class RegexConversion
java.lang.Object
com.univocity.parsers.conversions.RegexConversion
- All Implemented Interfaces:
Conversion<String,
String>
Replaces contents of a given input String, identified by a regular expression, with a replacement String.
The
revert(String)
implements the same behavior of execute(String)
. Null inputs produce null outputs.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRegexConversion
(String replaceRegex, String replacement) Creates a conversion that matches contents identified by the given regular expression and replaces them by the given replacement String. -
Method Summary
Modifier and TypeMethodDescriptionExecutes the regular expression provided in the constructor of this class against the input and replaces any matched content with the replacement String.Executes the regular expression provided in the constructor of this class against the input and replaces any matched content with the replacement String.
-
Field Details
-
replaceRegex
-
replacement
-
-
Constructor Details
-
RegexConversion
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 Details
-
execute
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:
execute
in interfaceConversion<String,
String> - Parameters:
input
- The input to have contents matched by the regular expression and replaced- Returns:
- The String resulting from the content replacement
-
revert
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:
revert
in interfaceConversion<String,
String> - Parameters:
input
- The input to have contents matched by the regular expression and replaced- Returns:
- The String resulting from the content replacement
-