Script Statements and Functions for String and Text Processing
You can use these scripting elements to benefit from string and text processing capabilities such as search, match, replace, and count patterns within strings or data sequences (text containers) while using the Automation Engine scripting language. They have full Unicode support.
Some of these scripting elements support regular expressions, which enable you to search text using patterns. The regular expression use the Boost C++ Libraries syntax. For more information, see the official Boost C++ Libraries documentation.
Additionally, some of them can work with text containers as long as they were loaded by one of the scripting elements available, for example one of the PREP_PROCESS_* elements, such as PREP_PROCESS_FILE or PREP_PROCESS_VAR. The scripting elements used to load them can provide text containers with columns. If so, you can also select a specific column and force these string and text processing functions to focus on the relevant column. For more information about the PREP_PROCESS_* script elements, see Retrieve Data Sequences.
Note: The terms Data Sequences and Text Containers are used interchangeably.
This page includes the following:
Scripting Functions for String and Text Processing
The following scripting functions are available:
-
Regex matches a complete string
You can use this scripting element with regular expressions.
-
Regex searches part of a string
You can use this scripting element with regular expressions.
-
Replaces text in a string according to a regex and a replacement rule
You can use this scripting element with regular expressions.
-
Counts occurrences of a pattern in a string or text container
You can use this scripting element with regular expressions, process handles, and also select specific columns and work only within them.
-
Finds occurrences of a pattern in a string or text container
You can use this scripting element with regular expressions, process handles, and also select specific columns and work only within them.
Scripting Statements / Functions for String and Text Processing
These scripts can be used as functions or statements, offering you flexibility in how they are applied.
When used as statements, they modify their input process handle, whereas functions do not modify the input handle and return results in a new handle. They provide a more efficient way to manipulate text containers (data sequences) and stack commands while avoiding the need to reload the text containers, from example, from files.
-
Sorts lines lexicographically
You can use this scripting element with process handles and select specific columns and work only within them, while a selected column is used as sorting criteria.
-
Makes adjacent strings unique
You can use this scripting element with process handles and select specific columns and work only within them, while a selected column is used for comparison.
-
Greps for strings
You can use this scripting element with regular expressions, process handles, and also select specific columns and work only within them, while a selected column is used for comparison.
-
:MODIFY_PROCESS, MODIFY_PROCESS
Searches and replaces
You can use this scripting element with regular expressions, process handles, and also select specific columns and work only within them, while a selected column narrows the part of the line that is modified.
-
Concatenates text containers (data sequences)
You can use this scripting element with process handles.
-
Cuts out a row or range of code points
You can use this scripting element with process handles and select specific columns and work only within them.
-
Takes lines from the beginning of the text
You can use this scripting element with process handles.
-
Takes lines from the end of the text
You can use this scripting element with process handles.
Scripting Statements for Text Processing
The following scripting statements are available:
-
Swaps two process handles
You can use this scripting element with process handles.
See also: