String Toolbox
UPPERCASE
Convert a string to uppercase characters.
Parameters
None - Data should be "chained" into this function.
Returns
The string converted into all uppercase.
Example Usage
Would yield:
lowercase
Convert a string to lowercase characters.
Parameters
None - Data should be "chained" into this function.
Returns
The string converted into all lowercase.
Example Usage
Would yield:
Base64 Encode
Encode a string to Base64.
Parameters
None - Data should be "chained" into this function.
Returns
The string converted into Base64.
Example Usage
Would yield:
Base64 Decode
Decode a string from Base64.
Parameters
None - Data should be "chained" into this function.
Returns
The Base64 string converted into "normal" text.
Example Usage
Would yield:
URL Encode
URL Encode a string (helpful when working with APIs).
Parameters
None - Data should be "chained" into this function.
Returns
The string converted into a URL encode.
Example Usage
Would yield:
URL Decode
URL decodes a string.
Parameters
None - Data should be "chained" into this function.
Returns
The string converted into a URL decode.
Example Usage
Would yield:
Split (extract section)
Extracts a section from a text or document.
Parameters
-
Start: Match string to begin the split. Included in the result. Case-sensitive.
-
End: The match string to end the split. Excluded from the result. Case-sensitive.
-
Remove Headers: If true, remove repeating lines of text (e.g. headers or footers). If false, do not remove repeating text.
Returns
The resulting split chunk of text.
Example Usage
Would yield:
Split (on delimiter)
Split a string on the specified delimiter, and store it in the variable name you choose for later use (eg, take a list of comma-separated names, and run a loop with each value).
Parameters
- Delimiter: The delimiting string or regex on which to split the input text.
- Output Json: If true, outputs the split result as a JSON array. Otherwise, this sets the mAIstro variables for the resulting split.
- Variable: The base variable name to use for the array.
Returns
If Output Json is set to true, returns an array split based on your delimiter.
Example Usage
I have 20 cats and 40 dogs.
{{ splitDelim | delimiter: "cats" | outputJson: "true" | variable: "" }}
Would yield:
Regular Expression
Performs regular expression on input data. Regular expression can be a powerful feature to extract or replace certain data.
Parameters
- Match: The match regex to use. E.g.
/[^0-9A-Za-z\s]/g
- Replace: The string to substitute for matches.
- Group: The group to extract. This is useful when multiple strings match the regex defined in the Match parameter, and you are only looking for one specific string.
Returns
The replaced text, or in case of using the group
parameter, the group match.
Example Usage 1
If you have a text that you need to replace with something else, you can use the following expression:
Which yields:
Example Usage 2
Regex also supports extraction. For example, if you want to extract the email address in a text message, you can do so:
my name is [email protected]
{{ regex | match: "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}" | group: "0" }}
This will extract the email address (group 0). The result is:
Example Usage 3
Regex also supports groups, so in case you want to get the last digits of a phone number, you can do so:
which will result in:
Escape a String
Escapes a string for use within a JSON object.
Parameters
None - Data should be "chained" into this function.
Returns
Escapes a string by inserting backslashes next to special characters, in order to overcome programming limitations.