Automation Action – Text Operation | ThinkAutomation
Automation Action: Text Operation
Perform various operations on text values.
Perform various operations on text.
The From value can be any text or %variable% replacement or combination.
Select the Text Operation Type:
| OperationType | Details |
|---|---|
| Trim: All Whitespace | All Whitespace (replaces all tab, CR, and LF characters, with space characters, and removes extra space’s so there are no occurrences of more than one space in a row). |
| Trim: Blanks | Blanks (removes all CR/LF/tab characters and trims). |
| Trim: End | Trims the last Length characters. |
| Trim: Start | Trims the first Length characters. |
| Trim: Start & End | Trims the first and last Length characters. |
| Get: Index Of | Returns the start position of Look For value in the From value (1 based). The Look for can be a regular expression or %variable% replacement. |
| Get: Left | Get the last Length characters. |
| Get: Right | Get the first Length characters. |
| Get: SubString | Get Length characters starting at Start Position. If Start Position is not a number then the value of Start Position will be searched in the From value – and the search position will be used (if found). |
| Get: Length | Returns the character length of the From value. |
| Extract: JSON Path | Get a specific Json Path value from Json text specified in the From valu |
| Extract: Regex | Get one or all matches of the Regex Pattern. |
| Extract: Summarized Text | Extracts the most important sentences in text to build a summary. Specify the Percentage and Maximum Sentences. |
| Replace: Regex | Replace one or more Regex Pattern matches with a replace pattern. |
| Set: Format | Returns a formatted value of the From value. The Format can be any .NET format. For example: ‘The delivery date is {0:d}’ would return ‘The delivery date is 1/1/2021’ if From contained a date value. |
| Mask: Inside | Replaces Length characters starting from Start Position with * characters. |
| Mask: Profanity | Replaces all profanity words with * characters. |
| Mask: Credit Card Numbers | Replaces all Credit Card numbers with * characters. |
| Convert: To Lower Case | Returns the From value as lower case. |
| Convert: To Upper Case | Returns the From value as upper case. |
| Convert: To Word Capitalized | Returns the From value as Word Capitalized. |
| Convert: CamelCase To Words | Returns the From value as words extracted from Camel Case. Eg: customerName would return ‘Customer Name’ |
| Convert: HTML To Plaintext | Returns the plaintext version of any HTML text. (see: HTML Parsing Notes) |
| Convert: HTML To Plaintext (Including Tables) | Returns the plaintext version of any HTML text with more layout. Also converts any HTML tables (with thead or th elements) to text with aligned rows and columns. |
| Convert: HTML To XML | Returns the well formed XML version of any HTML text. (see: HTML Parsing Notes) |
| Convert: HTML To Json | Converts HTML to XML and then converts the XML to Json. (see: HTML Parsing Notes) |
| Convert: HTML To Markdown | Converts HTML to Markdown. |
| Convert: Markdown To HTML | Converts Markdown to HTML. |
| Convert: CSV To HTML Table | Converts CSV text into a HTML table. |
| Convert: CSV To Markdown Table | Converts CSV text into a Markdown table. |
| Convert: CSV To Json Array | Converts CSV text into a Json array. |
| Convert: Json To CSV | Converts Json/Json Array text into CSV text with headers. |
| Convert: XML To Json | Converts XML text into Json. |
The ‘Sub String’ and ‘Get Index Of’ use 1 based index positions. ‘Get Index Of’ will return 0 if the Look For value is not found.
The Preview will show a preview of the operation. This is useful to check how the operation will work. The preview however will not show if the From text is a %variable% replacement (since the value will not be known until the Automation executes).
Select the variable to receive the result from the Assign To list.
<h5id=”html-conversion-notes”>HTML Conversion Notes
For the Text Operation action, when converting HTML to plain text, Markdown, JSON or XML there are a number of additional options:
- Suppress Links : If enabled then links will be removed before conversion.
- Suppress Images : If enabled then images will be removed before conversion.
- Drop Tags : You can enter a comma separated list of tags to remove from the HTML before conversion. This can be useful for removing navigation blocks and footers, if you only need the page content (eg:
<nav>and<footer>tags). Specify tag names (without enclosing<and>characters, eg:nav,footer) - Drop Tags With Class/Id Names : You can enter a comma separated list of class and/or id names. Any tags with matching class or ID names will be removed from the HTML before conversion.
<h5id=”regular-expression-extract”>Regular Expression Extract
For the Text Operation action, the Extract: Regex operation allows you to extract data from the From entry based on a regular expression in the Regex Pattern entry. If All Matches is enabled then all matches are returned (one per line).
For example if the From text is set to:
Product Code Quantity A1234 1
And the Regex Pattern is set to ”A[0-9]{4}” – which means any text starting with ‘A’ followed by 4 numbers (0-9). Then the returned text would be ‘A1234’.
<h5id=”regular-expression-replace”>Regular Expression Replace
For the Text Operation action, the Replace: Regex operation allows you to search for regular expression patterns and then perform a replacement on the matches. The replace pattern can contain substitutions.
For example if the From text is set to:
Phone Number: 4075452119
And Regex Pattern is set to “(?(d{3}))?[s-]?(d{3})-?(d{4})” and the Replace With set to “($1) $2-$3”. Then the returned text would be “Phone Number: (407) 545-2119”.