Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Regex for variations of a phrase

FreeRangeDingo
11 - Bolide
11 - Bolide

I have a text column for comments (see example below), and I need to know (True/False) whether it contains the misrun or misfire.  Misrun and misfire can be spelled or annotated with special characters.  I currently have a contains formula trying to find all the different spellings, but I know this is not a good way to do it.  Note, misrun and misfire can occur anywhere in the string. 

 

I know I can use the Regex tool set to Match to give me the true/false, but I don't know enough regex to write it.  Help would be greatly appreciated.  Thank you.

 

comments.pngvariations.png

12 REPLIES 12
estherb47
15 - Aurora
15 - Aurora
Hi @FreeRangeDingo,

Interesting challenge!

What about something along the lines of

Regex_countmatches([field],“mis.*run”)>0

For misfire and variants, try mis.*fire


Simplistic (and not on my computer to check), but should find all variations of both words.

The challenge that I’ve had with regex_match is that the contents of the entire field have to match the code. Regex count matches finds how many matches to a code are within a field.


Please let me know if that helps.

Cheers!
Esther
FreeRangeDingo
11 - Bolide
11 - Bolide

@estherb47 this is the best solution so far.  I wasn't able to make the others work, so I was back with my super clunky contains formula.  That formula filtered out 172 records from my data set.  Your solution filtered out 173 without the clunk. I also learned something new about regex_match versus regex_countmatches.  Thank you very much!

joshuaburkhow
ACE Emeritus
ACE Emeritus

Oooooh that is slick! Nice one @estherb47 !

Joshua Burkhow - Alteryx Ace | Global Alteryx Architect @PwC | Blogger @ AlterTricks
Labels