hello,
i have a field which is in the format below. i need to take the code from these fields which is always in the middle after the country name, it is always 9 characters long and starts with either a G or 1. Any easy way to do this?
BreadFrance103A01D88Bakery 1 |
PastaItalyG01004375Foods |
EggsUnited KingdomG01004375Fresh F |
Solved! Go to Solution.
Hi @Sammy22 one approach would be to use regex. The following Regex will first look for 1 or G then return 8 more characters I also unticked the case insenstive so I don't get a lower case g like in the third row.
This works almost but if there is another 1 or g before the code then it won't work for example if i have the below scenario.
TeaGermanyG12345678Drinks
This is great thank you! could you explain the expression to me as i have not used regex before please?
Is it possible you explain the two regex functions in words and the difference between them exactly? Trying to learn regex more... But I don't understand how this now still works even when countries contain a G. Thank you!
So first of Im using the parse method to extract the pattern I want to match into a new colmun. ([1G][A-Z0-9]{8}) The brackets () represent the entire pattern I want to parse. [1G] means look for either 1 or captial G then [A-Z0-9]{8} means looks for characters between A-Z captalised and 0-9 for 8 characters.