Replace by pattern Version 6 (Java)

Action group: Text


Description

Changes the text corresponding to the specified regular expression.

Action icon

Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
TextSource text for processing.Robin.String
Yes
RegexRegular expression to match.Robin.String
Yes
ReplacementNew value for the text to be replacedRobin.String
Yes
CountThe maximum number of times the replacement can occur. To replace all matches, use -1.Robin.Numeric
No
Ignore caseReplace occurrences ignoring case. Case is not ignored by default.Robin.BooleantrueNo
Results
ResultA string variable containing the processed text.Robin.String

Special conditions of use

None.

Example of use 

Task

There is a variable "Text" with the text: 

"Hello, Ivanov Ivan Ivanovich, we kindly ask you, Ivan Ivanovich, not to be late in paying the rent!". 

You need to replace the name "Ivan" with the name "Peter" and output the resulting text in the dialog box. 

Solution

Use the "Replace by pattern" and "Show message" actions. 

Implementation

  1. Assemble a robot scheme consisting of actions:

  2. Create a "String" variable to which the result of the "Replace by pattern" action will be written. 
  3. Set "Replace by pattern" action parameters
  4. Set the parameters of the "Show message" action 
  5. Launch the robot using the "Start" button in the top panel. 

Result

A dialog box with the modified text is displayed.

 

  • Нет меток