Replace
the replace tag allows you to use regular expression to replace very specific parts of other strings. The regular expression language is specific to Java's Pattern matching classes and you can find more information ont he specific regular expression syntax here Java Regular Expression You are also able to use group so that you can then replace the original expression with just one of the group using the $ sign, have a look at the examples below for a better understanding.
Required Attributes
source
Source value to apply replace on.
destination
The name of the property to record the result in.
expression
The regular expression to use when matching.
with
The new string to replace the match with.
Usage Examples
Example #1
<replace destination="newtest" expression=":" source="${test}" with="," />
Example #2
<replace destination="user" expression="([^@]+)@(.+)" source="${email}" with="$1" />
Example #3
<replace destination="host" expression="([^@]+)@(.+)" source="${email}" with="$2" />