In DataWorks Data Integration, you can use the string replacement component in single-table real-time synchronization tasks to replace strings in specified fields.
Step 1: Configure a Data Integration task
Create a data source. For more information, see Data source management.
Create a Data Integration task. For more information, see Configure a single-table real-time synchronization task.
NoteFor single-table real-time Data Integration tasks, you can add a data processing component between the source and destination components. For more information, see Supported data sources and synchronization solutions.
Step 2: Add the string replacement component
In the single-table real-time synchronization task, enable the Data Processing switch, click +Add Node, and select the Replace String component.
Configure rules.
Click Add rule and configure the following parameters. You can add multiple rules.
Field name: Select a text field from the previous node.
Content to be replaced: The string to search for. When regular matching is disabled, Java escape characters are supported, such as
\t(tab character),\n(line feed), and\u0001(Unicode character).Replacement content: The replacement string, which supports Java escape characters such as
\t(tab character),\n(line feed), and\u0001(Unicode character) when regular matching is disabled.
NoteRegular matching: Specifies whether to enable regular expression matching. When regular matching is enabled, see Class Pattern for the regular expression rules supported by the original string. You can use
$+numberin the new string to reference groups from the regular expression. For example, if the field content isno.9526, the original string is set tono.([0-9]+), and the new string is set to$1, the field content becomes9526after the replacement.Case Sensitive: Specifies whether the search for the original string is case-sensitive.
Next steps
After you configure the Data Source and String Replacement, you can click Preview Data Output to check if the output data of the current node meets your requirements.