Help Center

String Function Documentation 2024

Sarah B
Sarah B
  • Updated

 

This documentation provides a comprehensive explanation of the string functions available in our system.

Table of Contents

DATA_SELECT Function

The DATA_SELECT function allows you to extract specific information from data formatted in JSON, XML, or HTML. It takes two arguments:

  1. Data Type: Specifies the format: "JSON", "XML", or "HTML".
  2. Selector: Defines the path to the desired information using dot notation.

Key Points:

DATA_SELECT(JSON)[data.array~2.name]
  • The ~ symbol indicates an array position (e.g., array~2 refers to the second element).
  • Nested selectors navigate deeper within the structure.

JSON Example:

Syntax:

DATA_SELECT(JSON)[data.array~2.name]

JSON:

{
  "data": {
    "array": [
      { "name": "Item 1" },
      { "name": "Item 2" },
      { "name": "Item 3" }
    ]
  }
}

Explanation:

  • Extracts the "name" property from the second element of "array".
  • Selector uses dot notation.

Result: "Item 3"

HTML Example:

Syntax:

DATA_SELECT(HTML)[html.body.table.tr~2.td~1.text.innerText]

HTML:

<html>
<body>
  <table>
    <tr><th>Name</th><th>Description</th></tr>
    <tr><td>Item 1</td><td>A great product</td></tr>
    <tr><td>Item 2</td><td>This is the content we want to extract</td></tr>
    <tr><td>Item 3</td><td>Another product</td></tr>
  </table>
</body>
</html>

Result: "This is the content we want to extract"

XML Example:

Syntax:

DATA_SELECT(XML)[data.array.item[2].name]

XML:

<data>
  <array>
    <item><name>Item 1</name></item>
    <item><name>Item 2</name></item>
    <item><name>Item 3</name></item>
  </array>
</data>

Result: "Item 3"

REGEX_REPLACE Function

The REGEX_REPLACE function modifies text using a regular expression and a replacement value.

  1. Regex Pattern: The pattern to search for.
  2. Replacement Value: What to replace it with (can be empty).
REGEX_REPLACE([^a-z])[""] {{ [F].[description] }}

Result: Removes all characters except lowercase letters from [F].[description].

Example:

REGEX_REPLACE(SALE!)[""]{{We are having a sale on products this weekend! SALE! SALE!}}

Result: "We are having a sale on products this weekend! "

EXTRACT_REMOVE Function (and Related Functions)

These functions manipulate text based on a list of values.

  • EXTRACT_REMOVE: Removes values in a list.
  • EXTRACT_ALL: Joins all matches using a delimiter.
  • EXTRACT_FIRST: Extracts the first match.
  • EXTRACT_LAST: Extracts the last match.

Example:

List_Colors = Red, Green, Blue
EXTRACT_REMOVE(List_Colors){{ [F].[description] }}

Result: Removes all listed colors from the text.

Promotional Example:

List_Promotions = free for a limited time, don't miss this chance, get yours today, while supplies last
EXTRACT_REMOVE(List_Promotions){{This product is free for a limited time, don't miss this chance! Get yours today or while supplies last.}}

Result: "This product is."

Additional Notes:

  • This documentation is a basic overview. For more complex examples, check in-app code comments.
  • Need help? Contact support or refer to full system documentation.

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.