tReplace - 6.1

Talend Open Studio for Big Data Components Reference Guide

Talend Open Studio for Big Data
Data Governance
Data Quality and Preparation
Design and Development
Talend Studio


Carries out a Search & Replace operation in the input columns defined.


Helps to cleanse all files before further processing.

tReplace Properties

Component family



Basic settings

Schema and Edit Schema

A schema is a row description. It defines the number of fields (columns) to be processed and passed on to the next component. The schema is either Built-In or stored remotely in the Repository.

Click Edit schema to make changes to the schema. If the current schema is of the Repository type, three options are available:

  • View schema: choose this option to view the schema only.

  • Change to built-in property: choose this option to change the schema to Built-in for local changes.

  • Update repository connection: choose this option to change the schema stored in the repository and decide whether to propagate the changes to all the Jobs upon completion. If you just want to propagate the changes to the current Job, you can select No upon completion and choose this schema metadata again in the [Repository Content] window.

Two read-only columns, Value and Match are added to the output schema automatically.



Built-In: You create and store the schema locally for this component only. Related topic: see Talend Studio User Guide.



Repository: You have already created the schema and stored it in the Repository. You can reuse it in various projects and Job designs. Related topic: see Talend Studio User Guide.


Simple Mode Search / Replace

Click the button to add as many conditions as needed. The conditions are performed one after the other for each row.

Input column: Select the column of the schema the search & replace is to be operated on

Search: Type in the value to search in the input column

Replace with: Type in the substitution value.

Whole word: Select this check box if the searched value is to be considered as whole.

Case sensitive: Select this check box to care about the case.

Note that you cannot use regular expression in these columns.


Use advanced mode

Select this check box when the operation you want to perform cannot be carried out through the simple mode. In the text field, type in the regular expression as required.

Advanced settings

tStatCatcher Statistics

Select this check box to gather the job processing metadata at a job level as well as at each component level.

Global Variables

ERROR_MESSAGE: the error message generated by the component when an error occurs. This is an After variable and it returns a string. This variable functions only if the Die on error check box is cleared, if the component has this check box.

NB_LINE: the number of rows read by an input component or transferred to an output component. This is an After variable and it returns an integer.

A Flow variable functions during the execution of a component while an After variable functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl + Space to access the variable list and choose the variable to use from it.

For further information about variables, see Talend Studio User Guide.


This component is not startable as it requires an input flow. And it requires an output component.


If you are using a subscription-based version of the Studio, the activity of this component can be logged using the log4j feature. For more information on this feature, see Talend Studio User Guide.

For more information on the log4j logging levels, see the Apache documentation at

Scenario 1: Multiple replacements and column filtering

This following Job searches and replaces various typos and defects in a csv file then operates a column filtering before producing a new csv file with the final output.

  • Drop the following components from the Palette onto the design workspace: tFileInputDelimited, tReplace, tFilterColumn and tFileOutputDelimited.

  • Connect the components using Main Row connections via a right-click each component.

  • Select the tFileInputDelimited component and set the input flow parameters.

  • The File is a simple csv file stored locally. The Row Separator is a carriage return and the Field Separator is a semi-colon. In the Header is the name of the column, and no Footer nor Limit are to be set.

  • The file contains characters such as: *t, . or Nikson which we want to turn into Nixon, and streat, which we want to turn into Street.

  • The schema for this file is built in also and made of four columns of various types (string or int).

  • Now select the tReplace component to set the search & replace parameters.

  • The schema can be synchronized with the incoming flow.

  • Select the Simple mode check box as the search parameters can be easily set without requiring the use of regexp.

  • Click the plus sign to add some lines to the parameters table.

  • On the first parameter line, select Amount as InputColumn. Type "." in the Search field, and "," in the Replace field.

  • On the second parameter line, select Street as InputColumn. Type "streat" in the Search field, and "Street" in the Replace field.

  • On the third parameter line, select again Amount as InputColumn. Type "$" in the Search field, and "£" in the Replace field.

  • On the fourth paramater line, select Name as InputColumn. Type "Nikson" in the Search field, and "Nixon" in the Replace field.

  • On the fifth parameter line, select Firstname as InputColumn. Type "*t" in the Search field, and replace them with nothing between double quotes.

  • The advanced mode isn't used in this scenario.

  • Select the next component in the Job, tFilterColumn.

  • The tFilterColumn component holds a schema editor allowing to build the output schema based on the column names of the input schema. In this use case, add one new column named empty_field and change the order of the input schema columns to obtain a schema as follows: empty_field, Firstname, Name, Street, Amount.

  • Click OK to validate.

  • Set the tFileOutputDelimited properties manually.

  • The schema is built-in for this scenario, and comes from the preceding component in the Job.

  • Save the Job and press F6 to execute it.

The first column is empty, the rest of the columns have been cleaned up from the parasitical characters, and Nikson was replaced with Nixon. The street column was moved and the decimal delimiter has been changed from a dot to a comma, along with the currency sign.