Use match function to find variety of numbers

Match on numbers.morph (4.1 KB)


For table “Data”, I want to find the category for the product name.

Product name contains different lengths of numbers. And the numbers vary. I will use the match and lookup functions to find the category.

The code in the match name “([0-9]{6})-([0-9]{2})-([0-9]{1})” can be used in Excel file. But it seems it doesn’t work for EasyMorph.

Is there anything I can do here?


Hi Tesy, and welcome to the Community!

Thank you for the sample project - it greatly helped me to prepare an answer to your question.

The “Match” action you used in the project doesn’t support regular expressions (the patterns in your example). Instead, EasyMorph has a separate action called “Regular expression”. The action matches a list of values against one regular expression.

Since you have multiple regular expressions to match against, a loop (iteration) is necessary to match all products against all patterns.

Besides that, the “Match name” column in your example contains patterns (as regular expressions) and exact matches, so they have to be treated differently. Patterns should be matched using the “Regular expression” action, while exact matches require just a simple equality check.

Finally, a product can match both an exact match and a pattern (or several patterns), so you can have more than 1 match per product. You will need to figure out how to handle that.

Note that the match patterns in your example are not precise, for instance.

[3748597-17-6] has 7 digits in the 1st group of digits, but it matches the pattern ([0-9]{6})-([0-9]{2})-([0-9]{1}) (that expects 6 digits in the 1st group) because the pattern doesn’t specify that 6 digits must start immediately after the opening square bracket. The correct matching pattern would be


Notice \[ added in front of the 1st group. It specifies that 6 digits must follow an opening square bracket. You can learn more about regular expressions, for instance, here: Regular Expression Language - Quick Reference | Microsoft Docs.

Here is your sample project reworked:
Match on numbers.morph (9.3 KB)