↑↓ selectEnter openEsc close

    1. Elbuz

    Regular expressions for price lists: how to extract values from text

    23 min readUpdated

    Elbuz moves a SKU, volume or manufacturer code from a product name into its own field, or cuts an extra tail off the name. Set a rule once; it runs on every import.

    When you need this:

    • SKU in parentheses at the end of the name: the rule moves it to “Manufacturer SKU”, without parentheses.
    • The supplier gives SKUs only for some products: the rule fills only empty fields.
    • Extra tags like “(UA)” in names: the rule cuts them, keeping the SKU's parentheses.
    • Unsure how many products a rule hits: the test shows “before → after” before import.

    Where to start: add a rule in “Regular expressions” and test it.

    What a regular expression rule can do

    A regular search looks for specific text: “find the word Intel.” A regular expression looks for the shape of text: “find a few letters and digits in parentheses at the end of the line.” What exactly is written there doesn't matter to the program. That's why one rule works on thousands of different names at once.

    The main limitation: an expression understands shape, not meaning. It doesn't know what a SKU, a volume or a manufacturer is. If a name has two groups of digits followed by the letter “л” (liters), it takes the first one — even if it isn't liters (the dehumidifier example).

    Expressions use PCRE syntax — the same as code editors and most programs — so any cheat sheet from the internet will do. At the bottom of the test block there's a link: “Regular expressions, Wikibook.”

    The window header has a magic wand button — “Build a regular expression with AI.” It opens a chat with a ready-made question: describe in words what you want to find, and the assistant will suggest the expression.

    The window opens from the “Categories” submenu and its left tree shows your catalog categories, but it has nothing to do with sorting price list categories. It extracts values from text, most often from “Name.” To sort supplier products into your own categories, use category detection and distribution rules, not this window.

    How to create a rule

    The window is split in two. On the left is your catalog's category tree; on the right, the “Replacement rules” panel with the rule grid and the test block below it. At the top is a hint line: “Pick a category on the left, then add a replacement rule and test it on a sample text or on price products.”

    The Regular expressions window with category tree, rules panel and test block
    1Category tree
    2Add regexp
    3Build a regular expression with AI
    4Regular expression test
    1. Category tree — pick the category the rule belongs to.
    2. Add regexp — adds a replacement rule for the chosen product field.
    3. AI button — builds a regular expression with AI.
    4. Test block — checks the rule on a sample text or on price products.

    The “Add regexp” button

    The “Add regexp” button with a plus sign opens a list of price list product fields: every field of the product card, not only those mapped to your file (91 in our demo database). Pick the source field and the rule is created at once, no “Save” needed: a grid row appears with the cursor in the “Regular expression” cell.

    The list of product fields opened by Add regexp
    1Product field list
    1. Product field list — choosing a field creates a rule for it, so pick one only when you want a new rule.

    A new rule is on from the start: “Active” is “yes.” Initially the destination equals the source field, so the rule would write back where it read the text. To pick another field, use the narrow button to the right of the “Destination field” cell; the cell itself isn't editable. The “Manufacturer” column works the same way.

    The grid saves each edit as soon as you leave the cell, showing “Updated.” There are no drafts: change an expression, click away, and the new value is already in the database. So test an uncertain expression in the block below first instead of “leaving it until tomorrow” in an enabled rule.

    Source field and destination field

    The source field is set once, when you create the rule, and can't be edited afterward — if you picked the wrong one, delete the row and create a new one. The destination field can be changed at any time.

    The combination of these two fields defines what the rule is for. The most common case: source “Name”, destination “Manufacturer SKU” — extract the SKU from the name. The second most common: the same source and destination, “Name” → “Name” — cleaning up the name.

    The thirteen grid columns

    In column names, “regexp” is short for “regular expression.”

    Rule grid columns
    ColumnWhat it does
    “Source field”Where the text comes from. Set at creation and can't be changed
    “Destination field”Where the result goes. Picked from the field list
    “Regular expression”The pattern itself, in PCRE syntax
    “Backreferences \N”Filled in — only the part of the match you point to goes into the result. Empty — the whole match goes in
    “Rule order”Position among this price list's rules. A new rule gets the next step — 10, 20, 30 — so you can insert one between two others without renumbering the rest
    “Replace if destination is empty”On — the rule writes only to an empty field and leaves filled ones alone
    “Replace if regexp result is empty”Off — products where the expression found nothing stay as they were. On — they get an empty value
    “Default value if regexp result is empty”What to insert instead of an empty result
    “Default value if regexp result is not empty”Overrides the match: the field gets this text, not what the expression found
    “Manufacturer”The rule runs only on this manufacturer's products
    “Cut value from source field”The result is the original text without the matched fragment
    “Active”The rule's only on/off switch
    “Note”A free-form comment for yourself and your colleagues

    Two of these columns — “Replace if regexp result is empty” and “Default value if regexp result is empty” — decide the fate of products the expression didn't match. That's a separate topic, and it's exactly where the easy way to accidentally wipe a field in half the price list hides.

    How to limit a rule to a category or manufacturer

    The left panel shows your base catalog categories, not the price list's. At the top is a search field with the hint “Enter category name”: it searches from two characters, and Esc or an empty field resets the filter. Next to it, the “Additional operations” menu has four items: “Expand all categories”, “Collapse all categories”, “Refresh list”, “Clear filter”.

    The selected node does two things at once, and this is the key thing to understand about the left panel:

    1. It filters the grid. You see only this category's rules. Rules created under another selected node aren't “hidden by a filter” — they simply aren't shown.
    2. It binds new rules. A rule you create will run only on price list products that landed in this catalog category.

    The top node of the tree holds rules not bound to a category: they run on the whole price list. The top level is your store, so with several stores there are several such nodes, each meaning “no category.” Most tasks need exactly these, since the SKU must come from all names, not one branch.

    The window remembers the last selected node and opens on it next time. So the most common complaint, “the rule disappeared,” almost always means a different selected category, not a lost row.

    Binding to a category has a non-obvious condition. The rule compares the price list product's category with the one you selected in the tree — and catalog categories are assigned to products by a separate operation, “Distribute products across base catalog categories.”

    If regular expressions were moved before it in your source, a category-bound rule silently does nothing: on the source's first import no product has a category yet, and after that you can't rely on it — the distribution operation resets the category every time and assigns it again.

    This is rare. There are two fixes: move the rule to the top node of the tree (no category), or put the operation back in place in the “Order of operations” window.

    To limit a rule to a brand, use the “Manufacturer” column: the rule will process only products for which the “Search for a product manufacturer” operation has already identified that manufacturer (scenario “Codes in parentheses are correct for one brand only”).

    Extract a SKU from parentheses at the end of the name

    The most common task. Price list “Прайс Синтез-Груп.xml”, 6,549 products, with names like these:

    • Процессор Intel Core i3 10100 3.6GHz (6MB, Comet Lake, 65W, S1200) Box (BX8070110100)
    • Процессор Intel Core i3 10105 3.7GHz (6MB, Comet Lake, 65W, S1200) Tray (CM8070104291321)
    • Мультипечь Cecotec Cecofry DuoLevel 10000 (A01_EU01_109329)

    A name has several sets of parentheses, and you need the last ones — at the very end of the line. The rule:

    • Source field — “Name”
    • Destination field — “Manufacturer SKU”
    • Regular expression — (?<=\()[A-Za-z0-9_/. -]+(?=\)$)
    • Backreferences — empty

    Reading it: [A-Za-z0-9_/. -]+ is “one or more characters, each a Latin letter, digit, underscore, slash, period, hyphen or space.” Around it, (?<=\() and (?=\)$) require “an opening parenthesis on the left, a closing one and end of line on the right.” These are conditions, not part of the match: the parentheses must exist but stay out of the result.

    Result: the expression matched 2,969 products out of 6,549 and returned empty on 3,580. The “Manufacturer SKU” field got exactly BX8070110100, CM8070104291321, A01_EU01_109329 — no parentheses, no spaces.

    Empty on 3,580 products isn't a malfunction: half the names simply have no parentheses at the end. Products without a match stay as they were (see empty result).

    The most common trap is writing the same expression without these two constructs. The pattern \([A-Za-z0-9_/. -]+\)$ looks simpler and finds the right spot too, but the result is different:

    “Процессор Intel Core i3 10100 … Box (BX8070110100)” → (BX8070110100), parentheses included.

    The reason: the destination field gets the entire match. You wrote the parentheses into the expression, so they're part of the match. You expect BX8070110100, get (BX8070110100), and then can't figure out why matching by SKU doesn't find the product: in the catalog the SKU has no parentheses.

    There are two ways out. The first is conditions around the match, as in the expression above. The second is a backreference, covered in the next section.

    In the Синтез-Груп price list, the manufacturer SKU also comes in a separate column, which is handy: you can check the result against it. The value extracted by the expression matched that column in 2,850 cases out of 2,969. The other 119 are names where the parentheses at the end held something else:

    “Bluetooth-гарнитура Remax TWS-10i White (6972174153445)” → the expression returned 6972174153445, while the SKU column has TWS-10i. The parentheses at the end held a barcode.

    This is the limit described at the start: the expression seeks a shape, “Latin letters and digits in parentheses at the end of the line”, not knowing what the supplier put there. In practice such a rule is for price lists with no SKU column to check against; review its result by eye on the “based on products” tab.

    Take part of the match, not all of it

    You can extract the same SKU another way — and it's worth knowing, because it works where conditions around the match are hard to write.

    • Regular expression — ^.*\(([A-Za-z0-9_/. -]+)\)$
    • Backreferences \N — \1

    Here the expression describes the whole line, and the piece you need is wrapped in an extra pair of parentheses — ([A-Za-z0-9_/. -]+). In the “Backreferences \N” column you write \1: “take the contents of the first parentheses.” The 1 is the number of the group in the expression; with two groups, the second would be \2.

    Same coverage: 2,969 products out of 6,549, and the results match the first example. The difference is the approach: in the first case you narrow the match with conditions; in the second you match everything and say which part to keep.

    The “Backreferences \N” column is also worth remembering because it's the only way to assemble the result from several pieces or add your own text to the match. An empty column means “put the match in as is.”

    This column is often overlooked: people write conditions around the match or live with extra parentheses in the result. If you can't get an expression with conditions to work and the result comes with extra characters, start with this column — that's what it's for.

    Extract volume from the name — and where the expression gets it wrong

    The second example is harder, because it shows the tool's limit. Price list “Прайс Веселка Плюс.xml”, 1,350 products. You need the bowl or tank volume that the supplier writes right in the name.

    • Source field — “Name”
    • Destination field — a separate field for the volume
    • Regular expression — [0-9]+([.,][0-9]+)? ?л

    Reading it: one or more digits, then an optional fractional part after a period or comma, then an optional space and the letter “л” (the Ukrainian abbreviation for liters, since the names are in Ukrainian).

    Result: 323 products out of 1,350. Here's exactly what the expression returned:

    What the volume expression found
    NameResult
    Мультипіч ARDESTO 1450Вт, чаша-4л, сенсорне керув., 8 авто. програм, пластик, чорний4л
    Мультипіч ARDESTO, 1500Вт, об'єм-5.5л, сенсорне керув., 10 авто. програм, пластик, чорний5.5л
    Охолоджувач повітря ARDESTO ACO-B15 … резервуар 15 л., 410 м3/год …15 л
    Термосумка на колесах 2E, 50л, темно-синя50л
    Осушувач повітря промисловий 2E Air Master 150Pro 150л/добу 400м кв …150л

    Three takeaways from this table, and all three are useful.

    First: the result comes in different forms — “4л”, “15 л”, “5.5л”. The expression took what was in the text, including the space where there was one. If you need just the number, without the letter, that's where a backreference comes in: wrap [0-9]+([.,][0-9]+)? in parentheses and write \1.

    Second: the last row is an error, and an expression can't fix it. For the dehumidifier, “150л/добу” (150 L per day) is its capacity — how many liters of moisture it collects per day — not the tank volume.

    Same shape, different meaning. The expression doesn't know what a dehumidifier is; it saw digits before “л” and took them. That's exactly why this window has the “based on products” tab: to see on real products what came out before it goes into the catalog.

    Third: 323 out of 1,350 is a quarter of the price list. That's a normal figure for such a rule: not every name has a volume. What's not normal is expecting most products and getting a handful.

    For comparison: the weight expression [0-9]+([.,][0-9]+)? ?кг matched only two of the 327 products in the “Гармонія Центр” price list. The rule technically works, but setting it up for two rows makes no sense — and you can find that out in a minute, before importing.

    Remove a tail from the name: the “Cut” checkbox

    The third example is about cleanup, not extraction. Price list “Прайс Фенікс-Логістик.xlsx”, 1,990 products; some names end with a regional tag, “(UA)” or “(EU)”. On the storefront it's clutter.

    • Source field — “Name”
    • Destination field — “Name”, the same field
    • Regular expression — [ ]\((UA|EU)\)$
    • Cut value from source field — on

    [ ] at the start is a single space. You could type it as a plain space, but then you won't see it — neither here nor in the rule cell — and it matters: without it the tail disappears but the space before it stays, and the name ends with an invisible space.

    The square brackets around the space change nothing in how the expression works — checked on all 1,990 names in the price list; the result is identical character for character.

    The rule catches 113 products out of 1,990:

    Cleaning up the name with the “Cut value from source field” checkbox
    BeforeAfter
    Apple AirTag 4-pack (MX542) (EU)Apple AirTag 4-pack (MX542)
    Amazfit Active 2 Square Black Leather (W2440GL3N) (UA)Amazfit Active 2 Square Black Leather (W2440GL3N)
    Amazfit T-Rex 3 Pro 44mm Tactical Black (W2549GL5N) (UA)Amazfit T-Rex 3 Pro 44mm Tactical Black (W2549GL5N)
    Apple HomePod 2 Midnight (MQJ73/MQJ93/MDEW4AX) (EU)Apple HomePod 2 Midnight (MQJ73/MQJ93/MDEW4AX)

    Note that the parentheses with the SKU inside the name stayed in place. The expression requires the parentheses to be at the end of the line, and “(MX542)” doesn't meet that condition.

    The same rule without the checkbox

    The “Cut value from source field” checkbox flips the rule's meaning. With it, the destination field gets the text without the matched fragment. Without it, it gets the matched fragment itself:

    One rule, two results
    BeforeWith “Cut” onWithout the checkbox
    Apple AirTag 4-pack (MX542) (EU)Apple AirTag 4-pack (MX542)“(EU)”, including the leading space

    Both options are correct — they solve different tasks. Without the checkbox you extract the tag (for example, to put “UA” into a separate region field). With it, you remove the tag from the name.

    Described in words, this setting gets misunderstood almost every time, so the shortest path is to turn the checkbox on and look at the “based on products” tab: it shows both columns at once, “Original value” and “New value”. The “Based on text” tab also respects the checkbox, but shows the result for one pasted line only (two test tabs).

    A rule with the checkbox writes the result into the same field it read from. That is, the price list product name changes. This is the normal and most common way to clean up names, but check such an expression more carefully than others before enabling it: you aren't filling an empty field, you're rewriting a filled one.

    How to test a rule before importing

    Below the rule grid is the “Regular expression test” block with two tabs. They aren't equal: one works with a line you paste by hand, the other with real price list products, and only the second shows what will be written to the field.

    The Regular expression test block
    1Based on text tab
    2Based on products tab
    3Text field
    4Result field
    5Test button
    1. Based on text — test the rule on a sample text.
    2. Based on products — test the rule on price list products.
    3. Text — enter the sample text here.
    4. Result — the outcome appears here.
    5. Test — runs the test.

    “Based on text”

    This tab is for a single line. Paste a product name into the “Text” field, select the rule you're testing in the grid, and click “Test”. The “Result” field shows what the expression returned.

    Three things worth knowing in advance:

    • The “Text” field is empty — the button does nothing, and there's no message.
    • The expression ran but found nothing — the result field shows “Empty result!”.
    • No rule is selected in the grid — the result field simply clears, with no message. The same happens if the expression has a syntax error: an unmatched parenthesis or an unclosed square bracket. An empty field without “Empty result!” means: look for an error in the expression or select the rule row.

    The tab shows the same thing the import will do — for all kinds of rules, including those with the “Backreferences \N” column filled in or the “Cut value from source field” checkbox on.

    “based on products”

    The second tab shows the real imported products of this price list whose source field isn't empty, in two columns: “Original value” and “New value”. This is where you see coverage — how many products the rule gave anything at all — and misfires like “150л/добу”.

    The tab needs two things: the price list imported at least once and a rule selected in the grid; otherwise the list is empty. The tree node sets the scope: a selected category narrows the list to its products, the top node shows the whole price list. That's the normal way to test a rule not bound to any category.

    Before leaving a rule enabled

    When rules run

    Rules aren't applied when you write them. They run during price list import, as the “Auto-replacement of product values based on regular expressions” operation in the chain of import operations.

    Rules change price list products, not catalog product cards: the extracted value reaches the catalog later, through matching and catalog update.

    The Order of operations window listing price list processing steps
    1Auto-replacement based on regular expressions
    2Distribute products across base catalog categories
    1. Auto-replacement of product values based on regular expressions — must run after categories are assigned.
    2. Distribute products across base catalog categories — the step that should come first.

    Before regular expressions, the chain runs distribution into catalog categories, text replacement rules and manufacturer search. That's why category binding and the “Manufacturer” column work, and the expression already sees cleaned-up text. Next comes matching with the catalog — the extracted SKU makes it in time to take part — and then repricing.

    The order of operations is changed in the “Order of operations” window. Better not to go there without a reason: moving regular expressions earlier is exactly what breaks category binding. More: Order of operations during price list import.

    In what order the rules themselves run

    Within the operation, only rules with “Active” on are used, in the order set by the “Rule order” column. A new rule gets the next step — 10, 20, 30 — so you usually don't need to number them yourself. Rules created earlier still have zero there.

    Order matters when one rule prepares a field for another: the first extracts a fragment from the name, the second works with it. In that case, set different numbers explicitly. With equal numbers, rules run in creation order — oldest first — but don't rely on it: numbers are visible right in the grid, while creation order isn't visible anywhere.

    The program doesn't limit how many rules you can create or how many products they run on. Each active rule processes, in one pass, all price list products whose source field isn't empty — taking into account the category and manufacturer, if the rule sets them.

    Products aren't split into batches, and the operation has no separate time limit. The program doesn't show separately how much time the rules add to the import: the log shows the total price list import time.

    The “Stop” button is checked between operations in the chain, not between rules. If you click it after regular expressions have started, all rules finish first, and the import stops only before the next operation.

    The path of one product through one rule during import. The three lower diamonds are the columns from the empty-result section: they decide whether anything is written to the destination field or the product stays as it was
    noyesyesnoyesnoyesnoOperation “Auto-replacement ofproduct valuesbased on regular expressions”takes rules by “Rule order”“Active” on?Rule is skippedPrice list products selected: sourcefield not empty,category and “Manufacturer” — ifset in the rule“Backreferences”filled in?Result — textassembled from backreferencesResult — the matched fragmentor, with “Cut” and the same field,the text without itFilled-in default valuesreplace the empty and non-emptyresultResult empty and“Replace if regexp resultis empty” off?Product stays as it was“Replace if destinationis empty” onand the field is filled?Result is writtento the destination field; with “Cut”and different fields, the source fieldgets the text without the match
    • Start or end
    • Action or result
    • Decision: the path depends on the answer

    What happens if the expression found nothing

    An empty result isn't an error but a normal situation: in the SKU example, 3,580 of 6,549 products had one. Two columns decide what happens to them.

    What happens to a product with no match
    “Default value if regexp result is empty”“Replace if regexp result is empty”What happens to the product
    empty off (as in a new rule) Nothing. The field's old value stays in place
    empty on The field is cleared. An empty value is written, and the previous value is lost
    filled in either The value you entered is written

    The middle row is the easiest way to ruin your price list. The rule catches a quarter of the products, “Replace if regexp result is empty” is on — and the other three quarters end up with an empty field. The checkbox is off by default, and you'll have to clear it again by hand.

    A separate note on the last of these columns — “Default value if regexp result is not empty”. It works the other way round: when the expression finds something, the field gets not the match but whatever is written in this column.

    It's meant as a “something was found here” flag (for example, to put “yes” into a service field). If you fill it in by mistake, all products get the same text instead of the extracted SKUs.

    A rule has already overwritten values: how to restore them

    Rules have no “Undo” button, and the program doesn't keep the previous value: the rule writes straight into the price list product's field. So if a rule writes to the field it reads from, after such an import the “based on products” tab shows the corrupted value in “Original value”, not what was in the file.

    Only re-importing the price list restores values. Each import from a file first deletes this price list's old products, reads them from the file again, and only then applies the rules. Steps:

    1. Fix the expression or clear the rule's “Active” checkbox — otherwise the re-import corrupts the field the same way.
    2. Import this particular price list with the “Import” button.
    3. Check the result on the “based on products” tab.

    A few branches where restoring doesn't work:

    • If not a single product could be read from the file, old products aren't deleted and rules aren't applied. The log shows “No data received, previous product list will be displayed”, and the corrupted values stay as they were.
    • If the price list has “Process the price list only if the file has changed” on, an unchanged file is skipped when all price lists are imported or on schedule: the log shows “Price list data has not changed, skipping import”, and products aren't re-read. Importing a single price list with the “Import” button skips this check.
    • If a base catalog update already ran after the corrupted import, the wrong values may have reached the catalog too. Running the catalog update again recalculates products from price list data, so run it after the price list has been re-imported with the fixed rule.
    Only the bottom branch restores values: the two upper branches end the import before the price list's old products are deleted, so the corrupted fields stay in place
    yesnonoyesPrice list importImport of all price lists or onschedule,“Process the price list only if the filehas changed” on and the file is thesame?Skipped: “Price list data has notchanged,skipping import”corrupted values stayAt least one productread from the file?“No data received, previousproduct list will be displayed”rules aren't appliedOld price list products are deleted,products from the file are writtenagainChain of import operations,including regular expressionsPrice list product fields — from thefile,processed by the current rules
    • Start or end
    • Action or result
    • Decision: the path depends on the answer

    Scenarios

    Each scenario is one store task, the rule grid columns you fill in for it, and what you get after the next price list import. Columns not mentioned stay as a new rule sets them.

    The supplier fills in the SKU for only some products — add the rest from the name

    What to do. In the top node of the tree, add a rule with the source field “Name”. In the “Destination field” column, choose “Manufacturer SKU”; in “Regular expression”, enter the expression from the SKU section, and turn on “Replace if destination is empty”.

    What you get. Products whose SKU came from the file are left alone: the rule writes only where the destination field is empty. The rest get the fragment from the parentheses at the end of the name. Products whose name doesn't match keep an empty SKU, since “Replace if regexp result is empty” is off in a new rule.

    What won't happen. Catalog products don't change: the rule works with price list products, and the extracted SKU then takes part in matching, which comes after regular expressions in the import chain. And the expression can't tell a SKU from a barcode in the same parentheses — the next scenario deals with that.

    Codes in parentheses are correct for one brand only

    What to do. In the rule from the previous scenario, fill in the “Manufacturer” column: the manufacturer list opens from the narrow button to the right of the cell.

    What you get. The rule processes only price list products for which the “Search for a product manufacturer” operation has already identified that manufacturer — that operation runs earlier in the chain than regular expressions. Products of other brands, where the parentheses at the end of the name hold, say, a barcode, stay out of the rule's filtered set.

    What won't happen. The rule also skips products with no identified manufacturer — even if the brand is written in the name.

    Remove a regional tag from the name

    What to do. A rule with the source field “Name”, “Destination field” also set to “Name”, the expression from the cleanup section, and “Cut value from source field” on. Leave “Backreferences \N” empty: when it's filled in, the field gets the text assembled from the backreferences, and the checkbox no longer affects the result.

    What you get. Products whose name ends with “(UA)” or “(EU)” lose the tail along with the space before it. Names without such a tail stay the same. Subsequent import operations, including matching with the catalog, see the cleaned-up name.

    What won't happen. The supplier's file doesn't change: the next import reads the name with the tail again, and the rule removes it again. Parentheses inside the name, such as those with the SKU, stay in place.

    Flag products whose name contains a given feature

    What to do. A rule with your expression and a destination field you've set aside for the flag. In “Default value if regexp result is not empty”, enter “yes”; in “Default value if regexp result is empty”, enter “no”.

    What you get. Products where the expression found something get “yes” instead of the matched fragment; the rest get “no”. You don't need to turn on “Replace if regexp result is empty” for this: the default value is inserted before the program decides whether to skip a product with no match.

    What won't happen. Products with an empty source field stay out of the rule's filtered set and get no flag at all — neither “yes” nor “no”.

    What to do when a rule didn't work

    Symptom, cause and what to do
    What you seeWhyWhat to do
    “Empty result!” in the “Result” field The expression ran without errors but found nothing in this text Try a different text sample. Remember: by default such a product just stays unchanged (empty result)
    The “Result” field cleared, with no message Either no rule is selected in the grid, or the expression has a syntax error — an unmatched parenthesis, an unclosed square bracket Select the rule row and click “Test” again. If the field is empty again, look for the error in the expression itself (testing)
    On the “Based on text” tab, the “Result” field shows exactly the text you pasted The expression matched the whole text: this happens when it has no boundaries — for example, .* without saying what exactly you're looking for Narrow the expression and run it again; also check the “based on products” tab — coverage is easier to see on real names (two test tabs)
    The destination field got a result with parentheses, like “(BX8070110100)” The field gets the entire match. The parentheses are written into the expression, so they're part of the match Add conditions around the match: (?<=\()…(?=\)$) — or use the “Backreferences \N” column: that's a (how it works)
    The test shows the right result, but after the price list import the field is empty Most often “Active” is off: only enabled rules go into the operation. The second cause: “Replace if destination is empty” is on, and the field is already filled Check the “Active” checkbox and the “Replace if destination is empty” column (grid columns)
    A rule isn't in the list, though it was definitely created The grid shows rules of the selected tree node only. The rule was created under a different selected category Select the tree node under which the rule was created; the top node holds rules with no category (category tree)
    A category-bound rule didn't work on any product Products get their category from the “Distribute products across base catalog categories” operation. If regular expressions were moved before it, no product has a category on the first import, and after that it's reset and reassigned every time Move the rule to the top node of the tree, or put the operation back in place in the “Order of operations” window (when rules run)
    The destination field was wiped empty for some products “Replace if regexp result is empty” is on, and the expression found nothing on these products Turn off this checkbox or fill in “Default value if regexp result is empty” (empty result)
    All products have the same text instead of the found values “Default value if regexp result is not empty” is filled in, and it overrides the match Clear this column if you need the matched fragment itself (empty result)
    The “based on products” tab is empty or shows the wrong products No rule is selected in the grid, or the price list has never been imported. “Wrong products” is the node's scope: a selected category shows only its own products, the top node shows all products of the price list Select a rule, import the price list, and pick the tree node based on what you want to see (testing)
    Rules run in a different order than you intended The rules have equal numbers in the “Rule order” column, so they run in creation order rather than as you planned. Rules created before step numbering have zero there Give different numbers to rules that depend on each other (rule order)
    A rule can't be added or deleted, and a red message appears Your group doesn't have the right to edit price lists Read the message and ask an administrator to grant the right (who has access)

    FAQ

    Where do I start if I've never written regular expressions?

    Take a ready-made expression from this article, for a SKU or volume, paste it into a rule and click “Test” with your own product name. Then change one character at a time and watch the result. Or click the magic wand button and describe what you need to find.

    Can one rule both extract the SKU and remove it from the name?

    No, that takes two rules. The first reads “Name” and writes to “Manufacturer SKU”. The second reads “Name”, writes to “Name”, and has the “Cut value from source field” checkbox on. Give them different “Rule order” values.

    How do I extract a volume like “0,5 л” into a separate field or attribute?

    With a rule that has the source field “Name”, a separate price list product field as the destination, and the expression [0-9]+([.,][0-9]+)? ?л. Catalog attributes aren't among the destination fields. To get just the number without “л”, use a backreference. More: volume from the name.

    How many products will my rule affect?

    You can see it before importing: the “based on products” tab shows real price list products in two columns, “Original value” and “New value”. If there are only a handful of rows, the rule isn't worth creating.

    Does the rule change the supplier's file?

    No. Rules work with price list products inside the program, during import. Next time the supplier sends the same file, the rule runs again — that's exactly why names are cleaned up with a rule rather than by hand.

    How is this window different from “Text replacement rules”?

    Text replacement rules change a value in its own field and have a simple mode without expressions. “Regular expressions” put the match into any field and support a manufacturer filter and default values. More: text replacement or regular expressions.

    Can I see who changed an expression and when?

    No, the window doesn't keep a change history. For notes — why the rule exists and who created it — there's the “Note” column.

    Where to find it and who has access

    This window has no menu item. It opens from the list of price lists or from the source card — always for a specific price list. Both entry points lead to the same window.

    From the list of price lists
    menu in the source row → “Categories” group → “Regular expressions”
    From the source card
    “Additional” section → “Regular expressions” button
    Access right
    the “Regular expressions” window; adding and deleting rules requires the right to edit price lists
    Prepare
    a price list imported at least once, and a decision on which field you take the value from and which field it goes to

    There are no separate permissions inside the window: whoever sees the window sees all the price list's rules. Without the right to edit price lists, the program shows the reason in a red message, and the grid row neither appears nor disappears.

    Source actions menu with the Categories submenu open
    1Categories group
    2Regular expressions item
    1. Categories — the group that holds category-related tools; hover it to open the submenu.
    2. Regular expressions — opens the regular expressions window.

    The “Additional” section of the source card has the hint “Additional windows and price processing rules.” — the neighboring processing tools are there too. The window has no desktop shortcut.

    The Additional section of the source card with its buttons
    1Regular expressions button
    1. Regular expressions — opens the regular expressions window from the source card.

    Related topics

    Was this article helpful?

    Missing a feature? Tell us.

    We will add it for free if other users need it too.

    If only you need it, we will agree on it separately.

    Article contents

    Suggest an improvement

    Try Elbuz free