Help Center

Using String Functions in Feed Rules

Yesenia DeSalle
Yesenia DeSalle
  • Updated

String functions in GoDataFeed rules let you manipulate and extract information from text data in your product catalog. They modify, combine, or split text strings so a feed field outputs exactly what a channel requires. Use them to clean up titles, reformat SKUs, standardize casing, extract values from structured data, and more.


How do I add a string function to a rule?

String functions are applied inside a rule, in the SET row. The workflow is the same for every function:

  1. Create a new rule and give it a Rule name.
  2. In the SET row, click the FUNCTIONS button to open the list of available string functions.
  3. Select the function you want to use from the dropdown. A panel appears describing what the function does and showing an example.
  4. If the function has an empty value field, fill it in. Some functions take a value (for example, a character, a length, or a delimiter), and some take none. The panel tells you what that function expects.
  5. Reference the attribute you want the function to act on, such as [F].[title] or [F].[description].
  6. Click ADD FUNCTION, then set your WHERE conditions and SAVE the rule.

In the examples below, each function notes whether it takes a value and what to enter. Where a function uses an empty value field, the example shows exactly what to type.


wrenchblue.svg Upper case function

UPPER_CASE

The UPPER_CASE function converts all lowercase letters in a string to their uppercase equivalents. It takes no value, so you reference the attribute only.

Return value

A new string containing the uppercase version of the input string.

Example

Function: UPPER_CASE{{ [F].[brand] }}

Input: nike

Output: NIKE

Use cases

  1. Standardizing brand names or size values (S, M, L, XL) to a consistent uppercase format.
  2. Normalizing values so they match a channel's expected casing for attributes like color or condition.
  3. Formatting short codes or labels that a channel displays in all caps.

Limitations

  • The function only affects lowercase letters and does not modify numbers or special characters.
  • Applying it to a full product title can hurt readability and is usually not what a channel wants for titles.

wrenchblue.svg Lower case function

LOWER_CASE

Functionality

The LOWER_CASE function converts all uppercase characters in a string to lowercase. It leaves numbers, punctuation, and special characters unchanged, and takes no value, so you reference the attribute only.

Return value

A new string containing the lowercase version of the input string. The original string remains unmodified.

Example

Function: LOWER_CASE{{ [F].[google_product_category] }}

Input: Apparel & Accessories

Output: apparel & accessories

Use cases

  1. Normalizing values: Converting an attribute to lowercase so it matches a channel's required format or so duplicate values reconcile cleanly.
  2. Consistent matching: Lowercasing a value before comparing it in a rule condition, so casing differences do not cause a mismatch.
  3. URL or handle formatting: Producing lowercase values for fields that feed into product handles or link parameters.

Limitations

  • The function only affects uppercase characters. Other characters remain unchanged.
  • Lowercasing can hurt readability for proper nouns, brand names, or acronyms, so avoid applying it to customer-facing titles.

wrenchblue.svg Capital case function

CAPITAL_CASE

Functionality

The CAPITAL_CASE function capitalizes the first letter of each word in a string. It leaves numbers, punctuation, and special characters unchanged, and takes no value, so you reference the attribute only.

Return value

A new string with the first letter of each word capitalized. The original string remains unmodified.

Example

Function: CAPITAL_CASE{{ [F].[title] }}

Input: blue cotton running shoe

Output: Blue Cotton Running Shoe

Use cases

  1. Formatting titles: Capitalizing each word in a product title that arrives from the source in all lowercase.
  2. Standardizing attributes: Applying a consistent title-style format to brand, color, or material values across the catalog.
  3. Improving readability: Cleaning up values that were imported in inconsistent casing.

Limitations

  • The function capitalizes every word, including small words a style guide might leave lowercase (for example, "and," "of," "the").
  • The definition of a "word" can vary around hyphens and apostrophes, so check the output on values like "v-neck" or "men's."

wrenchblue.svg Sentence case function

SENTENCE_CASE

Functionality

The SENTENCE_CASE function capitalizes the first letter of the first word in a string and any word that follows a period. It leaves other characters unchanged, and takes no value, so you reference the attribute only.

Return value

A new string with the first letter of each sentence capitalized. The original string remains unmodified.

Example

Function: SENTENCE_CASE{{ [F].[description] }}

Input: this shoe is built for trail running. it has a waterproof upper.

Output: This shoe is built for trail running. It has a waterproof upper.

Use cases

  1. Formatting descriptions: Applying sentence case to product description copy that arrives in inconsistent casing.
  2. Standardizing copy: Producing a consistent reading format across long-text fields in the catalog.
  3. Improving readability: Cleaning up bulk-imported descriptions for customer-facing display.

Limitations

  • The function only capitalizes the first word and words following periods. Other characters remain unchanged.
  • It treats only periods as sentence boundaries, so words after question marks or exclamation points may not be capitalized.

wrenchblue.svg Split function

SPLIT

Functionality

The SPLIT function divides a string into an array of substrings based on a delimiter you enter in the value field. It breaks the string at every occurrence of that delimiter.

Return value

An array of substrings generated by splitting the input string.

Example

Function: SPLIT(,){{ [F].[categories] }}

Value to enter: the delimiter, here a comma (,)

Input: Shoes,Running,Trail

Output: ["Shoes", "Running", "Trail"]

Use cases

  1. Parsing data: Breaking a delimited attribute, such as a comma-separated category path, into individual values.
  2. Isolating a segment: Splitting a compound value so a later step can use one piece of it.
  3. Extracting information: Separating values that the source system concatenated into a single field.

Limitations

  • If the delimiter is not present in the string, the result is the original string unchanged.
  • Multiple consecutive delimiters or a delimiter at the start or end of the string can produce empty substrings.

wrenchblue.svg Substring function

SUBSTRING 

Functionality

The SUBSTRING function extracts a portion of a string based on a starting and ending position you provide. It returns the characters within that range.

Return value

A new string representing the extracted substring.

Example

Function: SUBSTRING(0,3){{ [F].[mpn] }}

Values to enter: a start position and an end position

Input: EU1456-BLK

Output: EU1

Use cases

  1. Extracting a code segment: Pulling a region prefix or category code out of a longer SKU or MPN.
  2. Building a value: Taking a fixed portion of an attribute to combine with other text.
  3. Trimming to length: Cutting a field down to a set number of characters to meet a channel limit.

Limitations

  • Start or end positions outside the length of the string can produce unexpected results, so verify against real data.
  • Confirm whether positions are counted from zero against your actual values before applying the rule across the catalog.

wrenchblue.svg Substring left function

SUBSTRING_LEFT

Functionality

The SUBSTRING_LEFT function extracts a set number of characters from the beginning of a string. Enter that number in the value field.

Return value

A new string containing the extracted leftmost characters.

Example

Function: SUBSTRING_LEFT(2){{ [F].[sku] }}

Value to enter: the number of characters, here 2

Input: EU1456

Output: EU

Use cases

  1. Extracting a prefix: Pulling a region or warehouse code from the start of a SKU.
  2. Truncating text: Shortening a value by keeping only its leading characters.
  3. Building fixed-length fields: Producing a value of a set length from the left of an attribute.

Limitations

  • If the number you enter is greater than the length of the string, the entire string is returned.
  • A negative number can produce unexpected results.

wrenchblue.svg Substring right function

SUBSTRING_RIGHT

Functionality

The SUBSTRING_RIGHT function extracts a set number of characters from the end of a string. Enter that number in the value field.

Return value

A new string containing the extracted rightmost characters.

Example

Function: SUBSTRING_RIGHT(3){{ [F].[sku] }}

Value to enter: the number of characters, here 3

Input: EU1456

Output: 456

Use cases

  1. Extracting a suffix: Pulling a size or variant code from the end of a SKU.
  2. Truncating text: Keeping only the trailing characters of a value.
  3. Building fixed-length fields: Producing a value of a set length from the right of an attribute.

Limitations

  • If the number you enter is greater than the length of the string, the entire string is returned.
  • A negative number can produce unexpected results.

wrenchblue.svg Count length function

COUNT_LENGTH

Functionality

The COUNT_LENGTH function returns the number of characters in a string. It takes no value, so you reference the attribute only.

Return value

An integer representing the length of the input string.

Example

Function: COUNT_LENGTH{{ [F].[title] }}

Input: Blue Cotton Running Shoe

Output: 24

Use cases

  1. Checking against channel limits: Measuring a title or description length so a rule can flag or shorten values that exceed a channel maximum.
  2. Data validation: Confirming that a value such as a GTIN has the expected number of characters.
  3. Conditional logic: Driving a rule that behaves differently based on how long a field value is.

Limitations

  • Special or control characters may be counted differently depending on encoding.

wrenchblue.svg Count string function

COUNT_STRING

Functionality

The COUNT_STRING function counts how many times a specific substring appears in a string. Enter the substring to count in the value field.

Return value

An integer representing the count of the substring occurrences.

Example

Function: COUNT_STRING(/){{ [F].[product_type] }}

Value to enter: the substring to count, here /

Input: Apparel/Shoes/Running

Output: 2

Use cases

  1. Measuring category depth: Counting the separators in a category path to see how many levels it has.
  2. Data validation: Checking that a delimited field contains the expected number of separators.
  3. Conditional logic: Driving a rule based on how many times a value appears in a field.

Limitations

  • The count may be case-sensitive, so "Shoe" and "shoe" can be counted separately.
  • Overlapping occurrences may not be counted.

wrenchblue.svg Format date function

FORMAT_DATE

Functionality

The FORMAT_DATE function converts a date value into a string based on a format code you enter in the value field. Use it on date attributes such as a sale start or end date.

Return value

A string representing the formatted date.

Format codes

The following format codes can be used within the FORMAT_DATE function:

  • FORMAT_DATE(:d): Short date format, typically day, month, and year separated by hyphens.
  • FORMAT_DATE(:D): Long date format, with day, full month name, and year.
  • FORMAT_DATE(:t): Short time format, showing hours, minutes, and seconds.
  • FORMAT_DATE(:T): Long time format, used in contexts that separate it from the date.
  • FORMAT_DATE(:f): Long date with short time.
  • FORMAT_DATE(:g): Short date with short time.
  • FORMAT_DATE(:M): Month and day only.
  • FORMAT_DATE(:r): RFC1123 format, often used in internet protocols.
  • FORMAT_DATE(:s): Sortable format following the ISO 8601 standard.
  • FORMAT_DATE(:u): Universal sortable format using UTC time.
  • FORMAT_DATE(:U): Long date with long time in Universal Time (UTC).
  • FORMAT_DATE(:Y): Year and full month name only.

Example

Applied to a [F].[sale_price_effective_date] attribute holding 19 March 2021:

FORMAT_DATE Code Description Example Output Explanation
FORMAT_DATE(:d) Short date format 19-03-2021 Date in a short format, with day, month, and year.
FORMAT_DATE(:D) Long date format 19 March 2021 Date with full month name, day, and year.
FORMAT_DATE(:t) Short time format 06:49:20 Time in hours, minutes, and seconds (24-hour clock).
FORMAT_DATE(:T) Long time format 06:49:20 Similar to :t, typically used in contexts needing separation from the date.
FORMAT_DATE(:f) Full date and short time format 19 March 2021 06:49:00 Combines long date with short time format.
FORMAT_DATE(:g) Short date and time format 19-03-2021 06:49:44 Combines short date and short time formats.
FORMAT_DATE(:M) Month and day format March 19 Displays only the month and the day.
FORMAT_DATE(:r) RFC1123 date format Thu, 19 March 2021 06:49:22 GMT Date and time in the RFC1123 format, used in HTTP headers.
FORMAT_DATE(:s) Sortable date/time format 2021-03-19T06:49:11 Date and time in a sortable format (ISO 8601).
FORMAT_DATE(:u) Universal sortable date/time format 2021-03-19 06:49:49Z Similar to :s but includes "Z" to denote UTC time.
FORMAT_DATE(:U) Full date and long time format (UTC) 19 March 2021 00:18:55 Long date and long time format in Universal Time (UTC).
FORMAT_DATE(:Y) Year and month format March, 2021 Displays only the year and month name.

Use cases

  1. Meeting a channel date format: Reformatting a sale start or end date to the exact format a channel such as Google Merchant Center requires.
  2. Standardizing dates: Producing a single consistent date format across the catalog.
  3. Data validation: Confirming that a date value is valid before it is submitted.

Limitations

  • Important: The function rounds decimal places, which may not suit cases where precision is critical.
  • Time zones and channel-specific requirements vary, so check the feed destination. For example, Google has its own required format that may need to be matched exactly.
  • Incorrect format codes can lead to unexpected results or errors.

wrenchblue.svg Format number function

FORMAT_NUMBER

Functionality

The FORMAT_NUMBER function converts a numeric value into a string based on a format code you enter in the value field. Use it on numeric attributes such as price or weight.

Return value

A string representing the formatted number.

Format codes

The following format codes can be used within the FORMAT_NUMBER function:

  • :f — Fixed-point notation with a default number of decimal places (usually 6).
  • :e — Scientific notation.
  • :g — General format, using fixed-point or scientific notation based on the magnitude of the number.
  • :n — Number format with grouping separators (for example, commas for thousands).
  • :00.00 — Fixed-point notation with exactly two decimal places, padded with zeros if necessary.
  • :0.000 — Fixed-point notation with exactly three decimal places, padded with zeros if necessary.
  • :0,0 — Number format with grouping separators and no decimal places.
  • :0.0 — Fixed-point notation with exactly one decimal place, padded with zeros if necessary.
  • :0% — Percentage format, multiplying the number by 100 and appending a percent sign.

Example

Applied to a [F].[price] attribute holding 12345.6789:

Input FORMAT_NUMBER function Output
12345.6789 FORMAT_NUMBER(:f) 12345.678900
FORMAT_NUMBER(:e) 1.234568e+04
FORMAT_NUMBER(:g) 12345.68
FORMAT_NUMBER(:n) 12,345.68
FORMAT_NUMBER(:00.00) 12345.68
FORMAT_NUMBER(:0.000) 12345.679
FORMAT_NUMBER(:0,0) 12,346
FORMAT_NUMBER(:0.0) 12345.7
FORMAT_NUMBER(:0%) 1234567.89%

Use cases

  1. Formatting price: Producing a price value with exactly two decimal places to meet a channel requirement.
  2. Formatting weight or dimensions: Setting a consistent number of decimal places on shipping weight or size values.
  3. Standardizing numeric output: Applying grouping separators or a fixed format across numeric fields.

Limitations

  • Important: The function rounds decimal places, which may not suit cases where precision is critical.
  • It may have limitations handling very large or very small numbers.
  • Incorrect format codes can lead to unexpected results or errors.

wrenchblue.svg Trim function

TRIM

Functionality

The TRIM function removes a character from the beginning and end of a string. You enter the character to remove in the value field. To remove leading and trailing whitespace, the most common use, press the spacebar once so a single space sits in the value field.

Note: TRIM removes the single character you specify when it sits at the start or end of the value, and it does not remove a multi-character block from the middle of a string. To strip a SKU such as EU1456 out of a title, use REGEX_REPLACE or EXTRACT_REMOVE instead.

Return value

A new string with the specified leading and trailing character removed. The original string remains unchanged.

Example

Function: TRIM( ){{ [F].[title] }}

Value to enter: press the spacebar once to place a single space in the value field

Input: " Blue Cotton Running Shoe "

Output: "Blue Cotton Running Shoe"

Use cases

  1. Cleaning titles and descriptions: Removing leading and trailing spaces that the source system leaves on a field.
  2. Stripping a stray character: Removing a leading or trailing character such as a | or - left on an imported value.
  3. Reliable matching: Cleaning whitespace off a value before it is used in a rule condition so it compares correctly.

Limitations

  • TRIM only affects the start and end of the string. It does not remove the character from the middle.
  • It removes the single character you specify. To remove a multi-character block or a pattern, use REGEX_REPLACE or EXTRACT_REMOVE.

wrenchblue.svg Trim left function

TRIM_LEFT

Functionality

The TRIM_LEFT function removes a character from the beginning of a string only. You enter the character to remove in the value field. To remove leading whitespace, press the spacebar once so a single space sits in the value field.

Return value

A new string with the specified leading character removed. The original string remains unchanged.

Example

Function: TRIM_LEFT( ){{ [F].[title] }}

Value to enter: press the spacebar once to place a single space in the value field

Input: " Blue Cotton Running Shoe"

Output: "Blue Cotton Running Shoe"

Use cases

  1. Cleaning a leading space: Removing a space the source system adds to the front of a title or description.
  2. Stripping a leading character: Removing a leading character such as a 0 or - from the front of a value.
  3. Reliable matching: Cleaning the front of a value before it is compared in a rule condition.

Limitations

  • TRIM_LEFT only affects the beginning of the string. It does not affect the end or the middle.
  • It removes the single character you specify. To remove a multi-character block or a pattern, use REGEX_REPLACE or EXTRACT_REMOVE.

wrenchblue.svg Trim right function

TRIM_RIGHT

Functionality

The TRIM_RIGHT function removes a character from the end of a string only. You enter the character to remove in the value field. To remove trailing whitespace, press the spacebar once so a single space sits in the value field.

Return value

A new string with the specified trailing character removed. The original string remains unchanged.

Example

Function: TRIM_RIGHT( ){{ [F].[title] }}

Value to enter: press the spacebar once to place a single space in the value field

Input: "Blue Cotton Running Shoe "

Output: "Blue Cotton Running Shoe"

Use cases

  1. Cleaning a trailing space: Removing a space the source system adds to the end of a title or description.
  2. Stripping a trailing character: Removing a trailing character such as a - or / from the end of a value.
  3. Reliable matching: Cleaning the end of a value before it is compared in a rule condition.

Limitations

  • TRIM_RIGHT only affects the end of the string. It does not affect the beginning or the middle.
  • It removes the single character you specify. To remove a multi-character block or a pattern, use REGEX_REPLACE or EXTRACT_REMOVE.

wrenchblue.svg Encode SHA256 function

ENCODE_SHA256

Functionality

The ENCODE_SHA256 function applies the SHA-256 hash algorithm to a string and returns a fixed-length hexadecimal hash. It takes no value, so you reference the attribute only.

Return value

A hexadecimal string 64 characters long.

Example

Function: ENCODE_SHA256{{ [F].[id] }}

Input: SKU-EU1456

Output: a 64-character hexadecimal hash of that value

Use cases

  1. Producing a hashed identifier: Generating a consistent hash of a product identifier when a channel or partner requires hashed values.
  2. Stable unique keys: Creating a repeatable identifier from an attribute value for matching or deduplication.

Limitations

  • SHA-256 is a one-way function, so the original value cannot be recovered from the hash.
  • Hashing very long input values can have performance implications.

wrenchblue.svg Encode base64 function

ENCODE_BASE64

Functionality

The ENCODE_BASE64 function converts a value into a Base64-encoded text string. It takes no value, so you reference the attribute only.

Return value

A text string representing the Base64-encoded version of the input.

Example

Function: ENCODE_BASE64{{ [F].[link] }}

Input: ProductPage

Output: UHJvZHVjdFBhZ2U=

Use cases

  1. Encoding a value for transfer: Producing a Base64 value when a channel or partner integration expects encoded input.
  2. Safe transport in text fields: Representing a value as text so it passes cleanly through a text-only field.

Limitations

  • Base64 increases the size of the value by roughly 33%.
  • Base64 is encoding, not encryption. It does not secure the value.

wrenchblue.svg Encode URL function

ENCODE_URL

Functionality

The ENCODE_URL function converts a string into a URL-safe format, replacing spaces and special characters with their encoded equivalents. It takes no value, so you reference the attribute only.

Return value

A string representing the URL-encoded version of the input.

Example

Function: ENCODE_URL{{ [F].[link] }}

Input: Blue Running Shoe

Output: Blue%20Running%20Shoe

Use cases

  1. Building product links: Encoding a value that becomes part of a product URL or tracking parameter.
  2. Query parameters: Producing a safely encoded value for a link parameter in a feed field.

Limitations

  • Depending on the implementation, the function may not encode every special character.
  • The encoded value is less readable than the original.

wrenchblue.svg Encode HTML function

ENCODE_HTML

Functionality

The ENCODE_HTML function converts special characters in a string into their HTML entities so the value renders correctly inside HTML. It takes no value, so you reference the attribute only.

Return value

A string with special characters replaced by their HTML entities.

Example

Function: ENCODE_HTML{{ [F].[title] }}

Input: Shirts & Ties

Output: Shirts & Ties

Use cases

  1. Safe HTML output: Encoding a value that contains characters like &, <, or > before it is placed in an HTML context.
  2. Preventing broken markup: Ensuring a description with special characters does not break the surrounding HTML.

Limitations

  • Depending on the implementation, the function may not encode every special character.
  • The encoded value can be longer than the original because of the added entities.

wrenchblue.svg Decode base64 function

DECODE_BASE64

Functionality

The DECODE_BASE64 function converts a Base64-encoded string back into its original value. It is the inverse of ENCODE_BASE64 and takes no value, so you reference the attribute only.

Return value

The decoded value as a string.

Example

Function: DECODE_BASE64{{ [F].[custom_label_0] }}

Input: UHJvZHVjdFBhZ2U=

Output: ProductPage

Use cases

  1. Reading encoded data: Decoding a Base64 value received from a source system so it can be used as plain text in a feed field.
  2. Data processing: Recovering the original value before further rule processing.

Limitations

  • The input must be a valid Base64 string. Invalid characters or padding cause decoding errors.
  • Decoding reverses Base64 only. It does not perform any decryption.

wrenchblue.svg Decode URL function

DECODE_URL

Functionality

The DECODE_URL function converts a URL-encoded string back to its original format. It is the inverse of ENCODE_URL and takes no value, so you reference the attribute only.

Return value

A string representing the decoded version of the input.

Example

Function: DECODE_URL{{ [F].[link] }}

Input: Blue%20Running%20Shoe

Output: Blue Running Shoe

Use cases

  1. Reading encoded parameters: Recovering the original value from a URL-encoded attribute.
  2. Data reconstruction: Converting an encoded value back to readable text for a feed field.

Limitations

  • Depending on the implementation, the function may not decode every encoded character.
  • Incorrectly encoded input can cause decoding errors.

wrenchblue.svg Decode HTML function

DECODE_HTML

Functionality

The DECODE_HTML function converts HTML entities in a string back to their original characters. It is the inverse of ENCODE_HTML and takes no value, so you reference the attribute only.

Return value

A string with HTML entities replaced by their corresponding characters.

Example

Function: DECODE_HTML{{ [F].[description] }}

Input: Shirts &amp; Ties

Output: Shirts & Ties

Use cases

  1. Cleaning encoded copy: Converting a description that arrives with HTML entities back to readable text.
  2. Data manipulation: Recovering original characters from an HTML-encoded attribute before further processing.

Limitations

  • Depending on the implementation, the function may not decode every HTML entity.
  • Incorrectly encoded input can cause decoding errors.

wrenchblue.svg Data select function

DATA_SELECT

Functionality

The DATA_SELECT function extracts a specific value from a product attribute that holds structured content formatted as JSON, XML, or HTML. It takes two arguments:

  1. Data type: The format of the source data — "JSON", "XML", or "HTML".
  2. Selector: The path to the value, written in dot notation.

In GoDataFeed rules, use DATA_SELECT when a catalog attribute stores nested or structured data and you need to surface a specific value as a feed field output.

Return value

A string containing the value extracted from the specified path within the structured content.

JSON Example

Syntax:

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

Source JSON:

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

The ~ symbol indicates an array position — array~2 selects the element at index 2. Selectors use dot notation to navigate nested levels.

Result: "Item 3"


 

HTML Example

Syntax:

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

Source 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]

Uses bracket-based element indexing to navigate XML nodes and retrieve the value of a named element.

Use cases

  1. Data extraction: Isolating a specific field from a structured attribute, such as pulling a weight value from a nested JSON specifications field.
  2. Surfacing a nested value: Selecting one value out of structured content to populate a flat feed field.
  3. Data transformation: Mapping a deeply nested attribute value to a flat feed field a channel requires.

Limitations

  • The function is limited to basic extraction. Complex transformations or joins require additional rule logic.
  • It may have limitations handling different character encodings or malformed structured data.
  • Array indexing uses 0-based positioning with the ~ notation. Always verify your selector against actual data to confirm the expected output.

wrenchblue.svg Regex replace function

REGEX_REPLACE

Functionality

The REGEX_REPLACE function replaces text that matches a regular expression pattern with a replacement string. You provide a pattern and a replacement. In GoDataFeed rules, use it to clean, reformat, or standardize attribute values, for example stripping a SKU out of a title, removing HTML tags from a description, or removing a currency symbol from a price.

Return value

A new string with the matched pattern replaced. The original string remains unchanged.

Example

This is the right function for removing a SKU like EU1456 from a title, because it matches and removes the whole block wherever it appears.

Pattern: EU1456    Replacement: (leave empty to remove)

Input: "EU1456 Blue Cotton Running Shoe"

Output: " Blue Cotton Running Shoe"

Follow it with a TRIM using a space to clean up the leading space left behind.

Use cases

  1. Removing a SKU or code from a title: Stripping a value such as EU1456 out of a product title so only the descriptive text remains.
  2. Data cleaning: Removing unwanted characters or markup, for example stripping HTML tags from a description or a currency symbol from a price.
  3. Reformatting values: Converting a value to a format a channel requires, such as standardizing a SKU pattern.

Limitations

  • Regular expressions can be hard to write. Test your pattern carefully before applying it across the full catalog.
  • Inefficient patterns can affect performance on large catalogs or long input values.
  • Overly complex patterns can produce unexpected results.

wrenchblue.svg Extract remove function

EXTRACT_REMOVE

Functionality

The EXTRACT_REMOVE function pulls a substring out of a string based on a delimiter or pattern you provide, and returns the string with that portion removed. In GoDataFeed rules, this is useful when an attribute combines two pieces of data, for example a SKU and a title in one field, and you want to keep one part and discard the other.

Return value

The function returns two values:

  1. The extracted substring.
  2. The modified original string with the extracted portion removed.

Example

Use this to separate a SKU from a title when both sit in one field, split by a delimiter.

Input string: "EU1456|Blue Cotton Running Shoe"

Delimiter: "|"

Output:

  • Extracted substring: "EU1456"
  • Modified string: "Blue Cotton Running Shoe"

Use cases

  1. Separating combined values: Pulling a SKU or code out of a field that combines it with the title or description.
  2. Keeping the remainder: Removing one part of a compound value while keeping the rest for a feed field.
  3. Data parsing: Isolating the relevant portion of a concatenated attribute value.

Limitations

  • The function may have limitations with overlapping matches or complex extraction patterns.
  • Performance can be affected by the length of the input and the complexity of the extraction criteria.

Frequently asked questions

How do I add a string function to a rule?

Create a new rule, and in the SET row click the FUNCTIONS button to open the list of available string functions. Select the function you want, and a panel appears describing it. If the function has an empty value field, fill it in, then reference the attribute you want to act on, such as [F].[title]. Click ADD FUNCTION to apply it.

How do I enter a space in the value field?

Click into the empty value field and press the spacebar once. That places a single space in the field, which is what the TRIM, TRIM_LEFT, and TRIM_RIGHT functions use to remove leading and trailing whitespace. The function reads as TRIM( ){{ [F].[title] }}, with a space between the parentheses.

Why is my TRIM not removing my SKU?

TRIM only removes a single character from the very start or end of a value, so it cannot remove a multi-character block like EU1456 from a title. To strip a SKU out of a title, use REGEX_REPLACE with the SKU as the pattern and an empty replacement, or use EXTRACT_REMOVE when the SKU and title sit in one field separated by a delimiter. After removing a SKU from the front of a title, run a TRIM with a space to clean up the leftover leading space.

Which functions need a value and which do not?

Some functions take a value in the field before the attribute, and some take none. Functions that change casing or encode a value, such as UPPER_CASE, LOWER_CASE, CAPITAL_CASE, ENCODE_URL, and ENCODE_SHA256, take no value, so you reference the attribute only. Functions like TRIM (a character or space), SUBSTRING_LEFT (a number), SPLIT (a delimiter), and FORMAT_DATE (a format code) need a value. The panel that appears when you select a function tells you what, if anything, it expects.

How do I shorten a title or description to meet a channel character limit?

Use SUBSTRING_LEFT to keep a set number of characters from the start of the value. For example, SUBSTRING_LEFT(150){{ [F].[title] }} keeps the first 150 characters. You can use COUNT_LENGTH first to check how long the current value is before deciding where to cut.

If you need additional support, contact our support team for further assistance. Be sure to provide any affected SKUs or screenshots of where you are encountering an issue.
Open a support ticket

Related to

Was this article helpful?

2 out of 5 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.