A source value contains a label and an expected contiguous candidate of 8 or 12–14 ASCII digits. Keep it as text, preserve a leading zero, and do not extract a fragment from a longer digit run.
In Transformations, add two rules in this order: first Not a regular expression with the guard pattern → Do not export field, then Regular expression with the extraction pattern → Remove everything except. The first rule clears an unsuitable value; the second keeps the first matching candidate.
How to do it in Eofferix
Open the settings of the output column or node. The name
barcodeis only an example; your field may have any other name. Keep the result as text so a leading zero is preserved.In Transformations, add the guard rule: Current value → Not a regular expression with
(^|[^0-9])(?:[0-9]{12,14}|[0-9]{8})([^0-9]|$)→ Do not export field.Immediately after it, add the extraction rule: Current value → Regular expression with
(?:[0-9]{12,14}|[0-9]{8})→ Remove everything except. Do not reverse the two rules.
The upper rule clears a value without an allowed candidate; the lower rule keeps the first candidate of an allowed length. Apply the rules and check the examples below in the preview. Then run a small test export and open the resulting file: unsuitable values should be empty, and suitable values should equal the first candidate found.
Expected result
| Source value | Result | Why |
|---|---|---|
EAN: 4006381333931 | 4006381333931 | A separate 13-digit candidate is found. |
barcode 012345678905 | 012345678905 | The 12 digits stay as text, including the leading zero. |
code 12345678 | 12345678 | An 8-digit candidate is allowed. |
12345678901234 | 12345678901234 | A 14-digit candidate is allowed. |
123456789012345 | empty | The recipe must not extract 14 digits from a longer digit run. |
ABC-12X34 | empty | There is no contiguous candidate of an allowed length. |
first 12345678 second 4006381333931 | 12345678 | When several candidates match, the first one is kept. |
What to check before export
- Both patterns use ASCII digits
[0-9]and allow only 8 or 12–14 digits. - The candidate digits must be contiguous. If a supplier inserts spaces or hyphens inside the code, add a separate normalization step and retest the boundary cases.
- When several candidates match, Remove everything except keeps the first one.
- This recipe checks only format and length. It does not verify an EAN/UPC/GTIN check digit or confirm that a product with the code exists.