Regular Expression
(Available from version 7.0 onwards.)
Functions
Returns a list of text segments that match the specified regular expression pattern.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
stringToSearch |
Text |
The text to search in. |
pattern |
Text |
The expression pattern. |
Returns
Returns a list of regular expression matches.
Example
See Project: Extract Text Data Using Regular Expressions for a complete sample project that demonstrates how to extract data from text using regular expressions.
The simple example below returns the occurrences of the word the in the text Testing the Extract Text by Pattern by looking for the pattern. The 2 results are returned to the list variable LVrem001.
Indicates whether a text segment, which matches the specified regular expression pattern, is found within the specified text.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
pattern |
Text |
The expression pattern. |
stringToSearch |
Text |
The text to search in. |
Returns
Returns 1 for True and 0 for False.
Example
This returns True into the Boolean variable SVBoolean001, as test is found in testament.
Replaces all occurrences of a specified regular expression pattern, with the replacement text.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
input |
Text |
The text to search. |
replacement |
Text |
The text to replace the pattern with. |
pattern |
Text |
The text pattern to be replaced. |
Returns
The text with replaced segments in Text format
Example
This example removes any repeated words from the specified text using regular expressions. (For an explanation of the regular expression shown, consult external RegEx resources.)
In debug mode, we can see that the OriginalText included the repeated word is. The modified text, CleanedText, does not include the repeated word.
Sample project: ReplaceTextSegmentsbyPattern