<< Click to Display Table of Contents >> Navigation: Actions > Regular Expressions > RegExp Replace |
This action performs search and replacement of regular expressions in a text. You can both replace the found expression entirely and combine a new one from the found subexpressions.
Text
External Text
Input the name of the text file in which the search will be implemented. Variables can be used.
Specified Text
In this field specify the text in explicit form on which you want to search. You can use variables.
Regular Expression & Replacement
Pattern (Regular Expression)
Input a regular expression (a phrase mask) for the search in a text. You can find description of regular expression syntax and manuals on the site http://www.regular-expressions.info/
Replacement
Input a text for replacement of the found expression. Variables and the found subexpressions can be used in the expression.
$0 corresponds to the whole found expression.
$1-$9 are subexpressions from 1 to 9, one after another.
For example:
If you want to put found expression into quotas write the following replacement:
"$0"
Replace Mode
•All entries - all matched entries will be replaced
•First entry - the action make replacement only at first entry
•Last Entry - the action make replacement only at last entry
Save Result to Variable
Input a variable name in which you want to put a text after performed replacements.
Additional options
Case Insensitive
Tries to match the regex without paying attention to case. If set, 'Bye' will match 'Bye', 'bye', 'BYE' and even 'byE', 'bYe', etc. Otherwise, only 'Bye' will be matched. Equivalent to (?i) modifier. The modifier (?-i) switches off the mode case insensitive.
MultiLine
The ^ (beginning of string) and $ (ending of string) regex operators will also match right after and right before a newline in the Subject string. This effectively treats one string with multiple lines as multiple strings. Equivalent to Perl's (?m) modifier. The modifier (?-m) switches off the mode multiline.
Single Line
Normally, dot (.) matches anything but a newline (\n). With Single Line mode, dot (.) will match anything, including newlines. This allows a multiline string to be regarded as a single entity. Equivalent to Perl's (?s) modifier. The modifier (?-s) switches off the mode single line.
Note that MultiLine and Single Line can be used together.
Extended Style
Allow regex to contain extra whitespace, newlines and Perl-style comments, all of which will be filtered out. This is sometimes called "free-spacing mode".
Anchored
Allows the regex to match only at the start of the subject or right after the previous match.
Ungreedy
Repeat operators (+, *, ?) are not greedy by default (i.e. they try to match the minimum number of characters instead of the maximum).
No Autocapture
Is a non-capturing group, only named groups will be captured.
Save the number of Replacements to Variable
If you need to save the number of performed replacements, switch on this checkbox and then input the variable name.
Related Topics