Top Description Fields Constructors Methods
com.univocity.parsers.conversions

public Class RegexConversion

extends Object
implements Conversion<String, String>
Class Inheritance
All Implemented Interfaces
com.univocity.parsers.conversions.Conversion

Replaces contents of a given input String, identified by a regular expression, with a replacement String. The RegexConversion#revert(String) implements the same behavior of RegexConversion#execute(String). Null inputs produce null outputs.
Author
Univocity Software Pty Ltd - [email protected]

Field Summary

Modifier and TypeField and Description
private final String
private final String

Constructor Summary

AccessConstructor and Description
public
RegexConversion(String
the regular expression used to match contents of a given input String
replaceRegex
,
String
the replacement content to replace any contents matched by the given regular expression
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 TypeMethod and Description
public String

Returns:

The String resulting from the content replacement
execute
(String
The input to have contents matched by the regular expression and replaced
input
)

Implements com.univocity.parsers.conversions.Conversion.execute.

Executes the regular expression provided in the constructor of this class against the input and replaces any matched content with the replacement String.
public String

Returns:

The String resulting from the content replacement
revert
(String
The input to have contents matched by the regular expression and replaced
input
)

Implements com.univocity.parsers.conversions.Conversion.revert.

Executes the regular expression provided in the constructor of this class against the input and replaces any matched content with the replacement String.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

replacementback to summary
private final String replacement
replaceRegexback to summary
private final String replaceRegex

Constructor Detail

RegexConversionback to summary
public RegexConversion(String replaceRegex, String replacement)

Creates a conversion that matches contents identified by the given regular expression and replaces them by the given replacement String.

Parameters
replaceRegex:String

the regular expression used to match contents of a given input String

replacement:String

the replacement content to replace any contents matched by the given regular expression

Method Detail

executeback to summary
public String execute(String input)

Implements com.univocity.parsers.conversions.Conversion.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 to RegexConversion#revert(String)

Parameters
input:String

The input to have contents matched by the regular expression and replaced

Returns:String

The String resulting from the content replacement

Annotations
@Override
revertback to summary
public String revert(String input)

Implements com.univocity.parsers.conversions.Conversion.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 to RegexConversion#execute(String)

Parameters
input:String

The input to have contents matched by the regular expression and replaced

Returns:String

The String resulting from the content replacement

Annotations
@Override