PPCDATAFEED

How to extract the size or colour from the product title

One rule, two lines: copy the title into a size field, then Regular Expressions keeps only the part that matches the pattern - for example XL or 42.

Many stores keep size and colour only in the title. Channels want them as separate fields - Google requires them for clothing variants. A regular expression pulls them out.

  1. Open the data source, go to Rules and click Add rule - for example “Size from title”.
  2. Under Then pick the field size (create it with New columns in the Products tab if it is not there), choose Combine or set value and pick title - this copies the title.
  3. Click Add action for a second line: size again, choose Regular Expressions and type the pattern in Regex (first match wins), for example \b(XXS|XS|S|M|L|XL|XXL)\b. The lines run top to bottom, so it works on the copied title.
  4. Add more patterns with Add regex - the first one that matches is used.
  5. Check Preview changes, then Save rule.
Rule “Size from title”: then size Combine or set value - title; and size Regular Expressions - Regex (first match wins) \b(XXS|XS|S|M|L|XL|XXL)\b

Example

Preview changes: size XL for Rain Jacket Blue XL, M for Rain Jacket Red M, L for Fleece Hoodie Grey L, S for THERMAL BASE LAYER BLACK S, XXL for Softshell Trousers Olive XXL
  • title Rain Jacket Blue XL → size XL
  • With a group in brackets only the group is kept: Size: (\d+) on Ring Size: 54 → 54
Regular Expressions works on the field it changes - that is why the title is copied first. A product with no match keeps the copied title, so add another rule below it if needed: size Contains a space → Set to empty.

Still stuck? Write to info@ppcdatafeed.com - we answer ourselves and can set it up with you.