Replace matches Version 8 (Java)


Description 

The action changes the specified text in the original text to the set one.

Action icon

Parameters

Input parameters

ParameterDescription
TextThe original text for processing.
ReplaceThe text in the original text to be replaced if present. 
ToNew value for the text to be replaced.

Output parameters

The output is a string variable containing the processed text.

Settings

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
TextText to make action onRobin.String
Yes
ReplaceThe string to be replacedRobin.String
Yes
ToThe string to replace all occurrences of ReplaceRobin.String
Yes
Results
ResultA string variable containing the processed text.Robin.String

Special conditions of use 

None.

Example of use

Task

There is a variable "Input text" with the text value: "Olya Ivanova, Olya Smirnova, Olya Petrova". Replace the first match for the name Olya with Masha. Display the changed text in the dialog box. 

Solution

Use the "Replace matches" and "Get message" actions.

Implementation

  1. Create a variable "Text variable" to which the "Replace matches" action result will be written.
  2. Move the "Replace matches" action to the workspace and set its parameters.
  3. Move the "Get message" action to the workspace and set its parameters. 
  4. Start the robot by clicking "Start" in the top panel.

Result

The dialogue window with the replaced text was displayed.

 

  • Нет меток