Transformations

How to extract the text inside brackets and remove everything else

2026-06-13
Task

A supplier sends a full path or description in one value, while the useful code is inside brackets. For example, from Furniture > Chairs [chairs] you need to keep only chairs.

Quick answer

Open the value settings and add transformation rules: first keep only the fragment matched by a regular expression, then remove the brackets themselves.

The example uses XML. The same setup also works for other formats when the value is opened in the transformation editor: JSON, CSV, XLS, XLSX, and other files.

Before / after

Before

Value
Furniture > Chairs [chairs]

After

Value
chairs

How to do it in Eofferix

  1. Open the template editor and find the field, cell, or node with the source value. In this example the needed code is in section_path.
    Source value with text in square brackets
    The red frame highlights the source value: the needed code is inside square brackets.
  2. Click the value and add three rules in Transformations.
    Transformation rules for extracting a value from brackets
    The first rule keeps the fragment matched by the regular expression; the second and third rules remove the opening and closing brackets.
  3. For square brackets, use the regular expression \[([^\]]+)\] and the action remove everything except.
  4. Add a rule contains substring [ -> remove substring. Then add the same rule for ].
  5. Save the settings. The current template will keep only the value from inside the brackets.
    Final value after transformation
    After saving, Eofferix shows the final value chairs. This value will go into the transformation result.

If the brackets are round

For a value like Furniture > Chairs (chairs), use \(([^)]+)\) instead, and configure the two substring removal rules for ( and ).

Process data faster with Eofferix

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

Sign up