Hello guys,
So I know it's complicated but I would appreciate any insights that any of you can provide.
So, I have such strings which I need to filter the number of grams that an item have.
For example from the string QUAKER OAT COOKIES HONEY NUT 9G => I would like to replace the text with just the integer "9".
Some strings don't include any grams count => so it's fine to drop down.
Thank you in advance.
Hi @sfh22,
Maybe you can try a data cleansing tool and choose that you want to keep only numbers?
Data cleansing tool have functionalities that allow removing all letters from a string
https://help.alteryx.com/current/designer/data-cleansing-tool
hey @sfh22
The best way to do this kind of text parsing is with the regEx tool. You will need to learn the language of regular expressions, but this is well worth doing because it's a key skill in data parsing.
In your particular case - the regular expression to use is .*?(\d+)G
Breaking this down:
So this regex says "give me any series of 1 or more numbers which is followed by G and is at the end of a piece of text. I've attached an Alteryx flow to this post
Resources: