Alteryx Designer Desktop Discussions

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

Hot to find a specific acronym in a text field

hellyars
13 - Pulsar

I want to find the acronym EW in a description field.   It is only 2-letters and always in ALL CAPS.

 

I tried the the Contains([Description], "EW").  This seems to pickup anything that contains "ew" in a word.

 

What might be a more direct way of zeroing in on this and other acronyms?

 

Thanks

8 REPLIES 8
neilgallen
12 - Quasar

@hellyars you can use regex and place your pattern in a word boundary (\b pattern \b). 

CharlieS
17 - Castor
17 - Castor

There's an optional third argument for the Contains function that will specify if you want the matching to be case sensitive. Try this formula:

 

Contains([Description],"EW",0)

 

 

BenMoss
ACE Emeritus
ACE Emeritus

Personally I would use the 'find and replace' tool to perform this task in append mode which you can then add a flag field too.

 

By default the find and replace tool is case sensitive though you can change that.

 

You would configure it to search 'any part of field'.

 

The benefit of the find and replace tool is you can easily extend this list to search for other values too.

 

Example attached.

 

Ben

hellyars
13 - Pulsar

@CharlieS that works.   @BenMoss you read my mind.   There are other search terms I will need to flag in the text field.   Your Find Replace approach works perfectly, especially the ability to add to the list and customize the "flag" output.  

 

Thank you. 

hellyars
13 - Pulsar

@BenMoss.  

 

Here is a twist.  I expanded my keywords to include both EW and IA.  How do use the Find Replace approach to account for records that might contain both keywords?

hellyars
13 - Pulsar

@BenMoss. I should clarify.  My output in the Flag field is no longer a simple "Y".   The output is now the acronym and there are more than one acronym.

 

FindFlag
EWEW
IAIA
NC3NC3

 

BenMoss
ACE Emeritus
ACE Emeritus

It depends based on exactly what you want to achieve.

 

Will a column only ever have one of the values? Or do you want to flag every occurence of a string?

 

I've built a batch macro which will flag, from a key word list, which values are within a text string.

 

Ben

hellyars
13 - Pulsar

@BenMoss.  Multiple keywords may appear in each 'description' field. 

 

The macro works, but I see that it creates a duplicate record for those (original) records that contain more than one keyword.

 

How can it be modified to output comma separated results.  Using your example to find bob and harry...

 

FieldFound
bob and harrybob, harry

bob and smith

bob

ron and veronica

null 

 

Thank you

Labels