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

Regex for variations of a phrase

FreeRangeDingo
ACE Emeritus
ACE Emeritus

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
Thableaus
17 - Castor
17 - Castor

Hi @FreeRangeDingo 

 

I think this is the kind of situation you could use some Fuzzy Match + data prep to get what you want, because writing a perfect REGEX could rbe a little trouble, since there might be a lot of variations.

 

Cheers,

joshuaburkhow
ACE Emeritus
ACE Emeritus

Couldn't you just simplify this to either contains "run" or "fire" then you don't need all those combinations. 

Joshua Burkhow - Alteryx Ace | Global Alteryx Architect @PwC | Blogger @ AlterTricks
MarqueeCrew
20 - Arcturus
20 - Arcturus
You could try:

Regex_match([perfstatus comment],"\bmis[^a-zA-Z]*?run\b")

The search will find words beginning with MIS that may be followed by non-letters followed by run and ending the word.

Cheers,

Mark
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
joshuaburkhow
ACE Emeritus
ACE Emeritus

Couldn't you just simplify this to either contains "run" or "fire"? then you don't need all those combinations. 

Joshua Burkhow - Alteryx Ace | Global Alteryx Architect @PwC | Blogger @ AlterTricks
FreeRangeDingo
ACE Emeritus
ACE Emeritus

Unfortunately not.  Something I don't want to flag is "All shots fired".  Good thought though. 

FreeRangeDingo
ACE Emeritus
ACE Emeritus

I will give Fuzzy Match a try.  I've not had good luck with it in the past.

MarqueeCrew
20 - Arcturus
20 - Arcturus
Please try my regex first!
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
FreeRangeDingo
ACE Emeritus
ACE Emeritus

I just hit run!  One sec....  🙂

FreeRangeDingo
ACE Emeritus
ACE Emeritus

Mark, 

   The regex expression did not return any matched.  ??? Is there more info I can provide?

 

Thanks,

 

Julie

Labels
Top Solution Authors