Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Issues with keyword search using regex_match

gavin_chin
6 - Meteoroid

Hi community

 

i am trying to identify key words from a list of transaction data  and have been experimenting with the regex_match function.  However, i have come across an issue where the key word is picking up a wildcard of the key word contained in other words

 

by way of example, the regex match function uses the key word "IGA" (a local supermarket franchise) but is returning additional words that contain "IGA" such as "SPIGA" .

 

 regex_match([vendor], ".*( IGA |Woolworths|Coles|Harris Farm|Aldi|Greenwood Grocer).*")

 

For example the data set could include

 

IGA North Sydney 

IGA Lane Cove

IGA Burwood

VIA DIA SPIGA

 

How can i update this expression (or utilise other tools) to ensure i am only picking up transactions that contain an exact match to the key word? In the above example, i would only want IGA North Sydney, IGA Lane Cove and IGA Burwood to be identified and not "VIA DIA SPIGA"  

 

many thanks

 

 

4 REPLIES 4
Ladarthure
14 - Magnetar
14 - Magnetar

Hi @gavin_chin,

 

here is the updated RegEx, you just needed to add somethign to specify it's a word you are looking for : 

regex_match([vendor], ".*(\<IGA\> |\<Woolworths\>|\<Coles\>|\<Harris Farm\>|\<Aldi\>|\<Greenwood Grocer\>).*")

PhilipMannering
16 - Nebula
16 - Nebula

Or 

REGEX_Match([Field1], ".*\<(IGA|Woolworths|Coles|Harris Farm|Aldi|Greenwood Grocer)\>.*")
gavin_chin
6 - Meteoroid

Thank you @Ladarthure 

 

 Your first suggestion worked to exclude the "VIA DI SPIGA" example. 

 

However, it seems to have inadvertently excluded other genuine transactions that contained the word "IGA" - for example the results using this regex_match in a Filter tool resulted in  

 

False:  "ROMEOS FOODHALL IGA"   

 

True  "IGA COOTA" or "ROMEOS IGA OXFORD ST"  were correctly picked up.

 

In the above, i would have expected "ROMEOS FOODHALL IGA" to also be captured as 'TRUE"

 

many thanks 

gavin_chin
6 - Meteoroid

@Ladarthure

 @PhilipMannering 

this one worked perfectly 🙂

 

thank you both

Labels