A supplier table stores price and stock as text: Price: USD 24.90 and Stock: 12 pcs. The import needs clean numeric fields price_clean and stock_clean.
If the text format may vary, extract the number with the regular expression [0-9]+(?:[,.][0-9]+)? (finds an integer or decimal number: one or more digits plus an optional decimal part after a dot or comma). If prefixes and units are stable across the file, remove them with substring rules.
How to do it in Eofferix
Method 1: use a regular expression in Eofferix
Create the output column
price_cleanfromprice_rawand open its settings.
The animation shows opening the output column settings. Add a rule: condition
Regular expression, value[0-9]+(?:[,.][0-9]+)?(finds an integer or decimal number: one or more digits plus an optional decimal part after a dot or comma), actionRemove everything except.
The rule keeps only the number from the price and removes surrounding text.
Method 2: use substring search in Eofferix
If the strings are stable, create
price_clean_textand remove the substringsPrice: USDand.
Substrings are useful when the supplier always uses the same prefix and unit. For stock, create
stock_cleanand remove the substringsStock:andpcs.
After both removals, only the stock number remains.
Before / after
Before
source data| vendor_code | name | price_raw | stock_raw |
|---|---|---|---|
| VN-1001 | Hudson lamp | Price: USD 24.90 | Stock: 12 pcs |
| VN-1002 | Parker chair | Price: USD 139.00 | Stock: 0 pcs |
After
result| vendor_code | name | price_clean | stock_clean |
|---|---|---|---|
| VN-1001 | Hudson lamp | 24.90 | 12 |
| VN-1002 | Parker chair | 139.00 | 0 |
What to keep in mind
- A regular expression is safer when currency can appear before or after the number.
- Substring rules are simpler for stable prefixes such as
Price: USDand units such aspcs. - Check several preview rows first: zero stock should remain
0, not become an empty value.