What are Regular Expressions?
Regular expressions are very helpful when it comes to complex feed optimizations. Their only drawback is that the learning curve is quite steep and it takes some practice to get the hang of RegExp.
Let's say you have a list of 100 IDs and you are able to find 3 patterns, that will match all your 100 values:
- 25 IDs start with ‘1’ and end with ‘7’
- 25 IDs start with ‘Adidas’ and end with ‘_2017’
- 50 IDs start with ‘2017’, end with ‘shoe’ and have ‘sale’ somewhere in the middle
If you know how to use regular expressions, you can replace a list of 100 values, with a list of just 3 values:
Regular expressions are pretty cool and efficient, right?
The great news is you do not have to know regular expressions to use the new ‘in list (regexp)’ feature.
How to use ''is in list (regexp)'' in your feed?
You probably know that you can use our ‘Add static value’ option to provide a color in your feed even if you do not have color field in your store - colors just need to be mentioned somewhere in your description or title.
However, things can get complicated if for each main color you have different shade names. Your blue products might have color names such as Indigo, Navy, Turquoise, Aquamarine and other variations.
You want to have them all renamed in your feed to the color blue. Therefore you can create a list of possible values that you can use as a blue color.
For all these values, you proceed with creating a simple rule that will create the attribute blue if any of the color variations is in the product title or description.
What is the difference between ''is in list (regexp)'' and ''is in list''?
You might be familiar with our ''is in list'' option which enables users to apply a rule to a list of specific products. The option is really useful and our users love it, but it can feel limiting at time.
If there is only one product with a different character or whitespace in that list of values that you uploaded, that product will not be considered as part of the list.
Let’s say you have the following list of values:
You can use the ''is in list'' functionality to add labels to your bestsellers. Through the list of specific values above you can only include the 3 IDs: 1, 1234 and 6789.
But this will not be the case anymore.
We have recently introduced a new option - ''is in list (regexp)'' . By choosing ''is in list (regexp)'' all IDs that contain 1, 1234 (they were already covered by the first line) and all IDs that contain 6789 will be considered as part of the list.
Same list of IDs, but quite a difference in the way our system reads it, based on which option you use.
What updates would you like for us to add on our to-do list? Feel free to leave a comment or to send an email to firstname.lastname@example.org.
Also, keep an eye on our blog, we’ve got some more goodies in the pipeline for you!