Hi all,
Recently I worked with Alteryx and the following question appeared:
How to extract the last symbols after the combination of “,” (coma and space)?
For instance, I have such rows:
1234 Metal, Wood, Containers, units
435792 Red bricks, t
38 Fresh Juice, aka Maracana, l
And I want to get the following column;
units
t
l
As you may have noticed, there are several combinations of “, “ in a string. However, their number may vary from 1 (the exact one before the units) to 4-5. So just splitting the text to columns using ", " does not help to create a column with a necesary data.
Could you please advise me, how it can be done?
Thanks
Solved! Go to Solution.
There is a way. The attached workflow uses the RegEx tool. You will want to parse the output and use the following expression:
[,]\s(\w+)$
papalow
Hi papalow,
Thank you for response, it worked but with some exceptions:
Роутер TP-Link, шт
Болт крепления М10*45 S14, шт
5717270018, ПЕСОК КВАРЦЕВЫЙ, 0,1-0,3, кг
5717270018, ПЕСОК КВАРЦЕВЫЙ, 0,1-0,3, кг
Боты диэлектрические 5171, пар.
Боты диэлектрические 5171, пар.
These items, for instance (and some other as well) returned Null in the Regex output column. However, when I created an additional file with these items only the Regex worked almost fine (only the last two returned Null instead of "пар."). Maybe you have an idea regarding this problem?
Hi, jdunkerley79
Thank you for your reply.
I tried both variants but they have returned only "??" or "???." etc. Perhaps it is due to the Cyrillic alphabet? The items are in Russian, for instance:
Роутер TP-Link, шт
Болт крепления М10*45 S14, шт
5717270018, ПЕСОК КВАРЦЕВЫЙ, 0,1-0,3, кг
5717270018, ПЕСОК КВАРЦЕВЫЙ, 0,1-0,3, кг
Боты диэлектрические 5171, пар.
Боты диэлектрические 5171, пар.
Could you please advise how the formula can be upgraded in this context?
It has worked perfectly, thanks a lot!
The last 2 items have a punctuation mark. You could insert a RegEx tool into the workflow to remove the punctuation on the last character. The output method would be replace. The regular expression would be [.]$.
Thanks for providing your second solution -- it is one I hadn't thought of.