We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Acronyms in cells

jenettd
7 - Meteor

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!

13 REPLIES 13
OTrieger
13 - Pulsar

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+\>\)

flying008
15 - Aurora

Hi, @jenettd 

 

FYI.

Spoiler
((?:[A-Z][a-z]+\s)+)(\([A-Z]+\))

录制_2025_02_25_11_26_18_547.gif

 

TxtFullAcronyms
such as Accounting Unit (AU).Accounting Unit(AU)
Bob is a great salesman because he Always Be Closing (ABC). He has a brilliant future in sales.Always Be Closing(ABC)

 

 

Yoshiro_Fujimori
15 - Aurora
15 - Aurora

@jenettd 

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.

workflow.png

 

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

AcronymFull
(AU)Accounting Unit
(ABC)Always Be Closing
(NATO)North Atlantic Treaty Organization
jenettd
7 - Meteor

Thank you all for the solutions. You've been very helpful.

Labels
Top Solution Authors