Interpreter

How to extract a SKU and remove extra characters with a regular expression

2026-05-27
Task

A supplier line contains the SKU together with a label or comment, such as SKU: ab-100/7. You need the actual SKU without removing meaningful separators.

Short answer

Use a regex that matches the real supplier SKU format, keep the match, and only then apply uppercase or other normalization.

How to do it in Eofferix

  1. Open the settings of the column or node that produces the final SKU.
  2. Add a Regular expression rule with a pattern that allows letters, digits and real SKU separators.
  3. Use Keep only matching text to remove labels such as SKU: or Item code.
  4. If needed, add Uppercase as the next rule.

A SKU should not be cleaned like a phone number or a barcode: letters, dashes, underscores, dots, and slashes can be part of the product code. A regular expression lets you keep the SKU and remove labels such as SKU:, supplier comments, or extra text.

You can choose an expression from the preset library with the star button or type it manually. For SKUs, a manual pattern is often more accurate because each supplier can use its own code format.

Example: extract the SKU and convert it to uppercase

The first rule uses the regular expression condition and the remove all except action. The second rule converts the result to uppercase.

SKU cleanup settings with a regular expression and uppercase conversion
The pattern keeps a compound SKU with a dash, underscore, dot, or slash.
BeforeRulesAfter
SKU: ab-100/7[A-Za-z0-9]+(?:[-_./][A-Za-z0-9]+)+uppercaseAB-100/7
supplier code sku-55_blue[A-Za-z0-9]+(?:[-_./][A-Za-z0-9]+)+uppercaseSKU-55_BLUE

Useful patterns

ScenarioPatternResult
Compound SKU with separators[A-Za-z0-9]+(?:[-_./][A-Za-z0-9]+)+Keeps AB-100/7 from a value with a label.
SKU made of letters, digits, dash, and underscore^[A-Za-z0-9_-]+$Useful for checking an already cleaned value.
SKU may have no separators[A-Za-z0-9]{3,}Keeps a simple code such as ABC100.

Process data faster with Eofferix

Create a free account to automate catalogs and price lists around your own rules.

Sign up