Is there a way to pick out the spelled-out version of acronyms in a cell?
For instance, the below sentences are in one cell.
'Bob is a great salesman because he Always Be Closing (ABC). He has a brilliant future in sales.'
I would need Alteryx to see that 'Always Be Closing' is spelled out for the acronym 'ABC'. The acronyms will always be in parentheses and the spelled-out version should always precede the acronym in parentheses.
Thanks!
Solved! Go to Solution.
As if you have a scenario for 1 word, then you will need to add one more RegEx tool and run it again with this code
(\u\l+\s)\(\<\w+\>\)
If the length of acronym may vary, I would dynamically retrieve the relevant words according to its length.
I hope it helps.
Input Data
Txt |
such as Accounting Unit (AU). |
Bob is a great salesman because he Always Be Closing (ABC). He has a brilliant future in sales. |
The North Atlantic Treaty Organization (NATO) has its roots in the Atlantic Charter. |
Workflow
Each formula tool has one expression to show you how it works.
Once you are comfortable with the process, you can put them together.
Formula
There might be more elegant solution with RegEx. Please take it as an alternative solution.
Acronym = REGEX_Replace([Txt], ".*(\(\u+\)).*", "$1") // get the acronym
WordCount = REGEX_CountMatches([Acronym], "\u") // get the length of acronym
temp = Left([Txt], FindString([Txt], [Acronym])) // get the string before the acronym
temp = ReverseString([temp]) // reverse the string
temp2 = GetWord([temp], [WordCount]) // get the word before the name
temp = Left([temp], FindString([temp], [temp2])) // get the string for the acronym
temp = ReverseString([temp]) // reverse back
temp = Trim([temp]) // trim leading/trailing space
Output Data
Acronym | Full |
(AU) | Accounting Unit |
(ABC) | Always Be Closing |
(NATO) | North Atlantic Treaty Organization |
Thank you all for the solutions. You've been very helpful.