Hi,
Say I have strings like -
4000 - Walmart Retail : NY USA - US-ABC-DE
How can I parse this entire column to get this result "US-ABC-DE"?
Thanks.
Solved! Go to Solution.
Use the RegEx tool with this formula:
.*?\-.*?\-\s(.*)
This website helps: https://regex101.com/
Chris
Hi @wonka1234 ..
Or you can write this expression in Formula Tool:
REGEX_Replace([Field Name], ".*-?.*-?\s(.*)", "$1")
Hi, @wonka1234
RegEx formula:
Trim(REGEX_Replace([Txt], '^[^-]*?-[^-]*?-', ''))
If you won't use regex expression:
Trim(Right(Right([Txt], Length([Txt]) - FindString([Txt], '-') - 1), Length(Right([Txt], Length([Txt]) - FindString([Txt], '-') - 1)) - FindString(Right([Txt], Length([Txt]) - FindString([Txt], '-') - 1), '-') - 1))
If your text is standard, i.e 2-3-2, then you can do something simple like:
(US-[A-Z]{3}-[A-Z]{2})
Of course, if it gets more complex, for example, if you have the following strings which are alphanumeric:
4000 - Walmart Retail : NY USA - US-ABC-DE
4000 - Walmart Retail : NY USA - US-sadsad-DE3
4000 - Walmart Retail : NY USA - US-213sdfsad-DeasE
You can try:
((?:US[A-Z0-9-]*[A-Z]+-[A-Z0-9-]*[A-Z]+))
But if they are non-standard, then the solutions provided by @flying008 @Rana_Kareem @ChrisTX are good to go.