Replace by pattern Version 6 (Java)
Action group: Text
Description
Changes the text corresponding to the specified regular expression.
Action icon
Settings of parameters
Property | Description | Type | Filling example | Mandatory field |
Parameters | ||||
Text | Source text for processing. | Robin.String | Yes | |
Regex | Regular expression to match. | Robin.String | Yes | |
Replacement | New value for the text to be replaced | Robin.String | Yes | |
Count | The maximum number of times the replacement can occur. To replace all matches, use -1. | Robin.Numeric | No | |
Ignore case | Replace occurrences ignoring case. Case is not ignored by default. | Robin.Boolean | true | No |
Results | ||||
Result | A 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
- Assemble a robot scheme consisting of actions:
- Create a "String" variable to which the result of the "Replace by pattern" action will be written.
- Set "Replace by pattern" action parameters
- Set the parameters of the "Show message" action
- Launch the robot using the "Start" button in the top panel.
Result
A dialog box with the modified text is displayed.
Обзор
Инструменты контента