community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE
SOLVED

RegEx alternative to multiple Contains function

Meteoroid

Hello all,

 

I am trying to find an elegant way to convert multiple Contains function check to a single RegEx_Match function but not able to get good results. Any advise here

 

!Contains([Description],"trail")
AND
!Contains([Description],"mod")
AND
!Contains([Description],"chg")

 

Alternate:

REGEX_Match([Description],".*^[(mod),(chg),(trail)].*")

Try this one instead!

 

REGEX_Match([Field1],".*trail.*||.*mod.*||.*chg.*")

 

The || operates as an "or" and looks for anything that contains trail, mod, or chg anywhere in the field (putting the .* on either side allows for other characters before or after the words you're searching for).

 

Hope that helps! 

 

Cheers,

NJ

Mine is similar to @NicoleJohnson:

 

!REGEX_Match([Description],".*(mod|chg|trail).*")

You only need a single | for alternatives in REGEX

 

Oops! Thanks @jdunkerley79! Yours looks much more elegant... :)

 

NJ

Alteryx Certified Partner
Alteryx Certified Partner

A similar post:  Using-IN-within-a-Contains-function

 

@jdunkerley79 and I approached it the same way.

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Meteoroid

Thank you and it worked very elegantly. 

 

Any idea on how to match this string "AC Pur off lse - - AI" with my unsuccessful attempt with REGEX_Match([Description],"^(AC ).*") ?

 

The following string does gets matched but not the one above.

AC Data Comm - - AIR2

Alteryx Certified Partner
Alteryx Certified Partner

does this do what you want?

 

REGEX_Match([Description],"^AC\s.*")

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Highlighted
Meteoroid

It worked with a correction that I had to make to another exclusion condition where I had the group match (CAP) typed as [CAP].

 

Thanks !

Labels