Getting text using regular expressions
Regular expressions are a formal language for searching and manipulating substrings in text based on the use of metacharacters (wildcard characters). Description on wikipedia .
Regular expressions can be set for all categories of goods in the base catalog, as well as for selected ones. If you want to use regular expressions for specific categories, then the products from the price list should be distributed to the categories of the base catalog. If you need to set up the use of regular expressions for all categories, then select the "List of categories" item.
When working with regular expressions, the REGEXP_REPLACE(subject, pattern, replace) function is used to replace values, here is its description .
How to set up getting the text you need.
An example of getting the text that is specified after the comma. Regular expression used: [^,]*$
- Select a product category on the left.
- Select the source field from which to take the value to apply the regular expression.
- Select the destination field, that is, where to save the result of the regular expression.
- Specify a regular expression.
- Specify the text to check.
- Click the "Test" button, in the "result" field the value that was obtained through the use of a regular expression will appear
Description of columns
1. Source field - where to get the value for processing it through regular expressions.
2. Destination field - where to save the result of the regular expression.
3. Regular expression.
4. Backreferences to subexpressions - allows you to get the result group of a regular expression, for example: /2.
5. The order of application - under different conditions, you can set the order.
6. Replace if empty result RE - when this flag is activated, the result of the expression will be checked, if it is empty, then the value for the target field will not be filled with an empty result.
7. Default value if the result of the expression is empty RE - fixed value for the target field if the result of the expression is empty.
8. Default value if non-empty RE result - a fixed value for the target field if the result of the expression has some text (non-empty value).
9. Manufacturer - take into account the selected manufacturer of the goods for applying the expression.
10. Cut value from source field - the result of the expression will be cut from the source value
11. Activity - the activity status of the expression to apply it to products.
12. Note - any comment, such as what this expression is for and what it does.
A regular expression can be texted immediately on products loaded from the price list, to do this, open the "Based on products" tab and click the "Test" button
Another option for compiling a regular expression is to use a visual editor created specifically for this purpose.
It is necessary to specify the source text (2) for which the regular expression will be applied, start compiling it (1) and observe the result (3) on the right side.
Regular expression examples
Obtaining the article number of the goods indicated in brackets
Obtaining the numeric article of the product indicated in brackets