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_Match function to match subset

kavithabanda
7 - Meteor

Hello!

 

I'm trying to resolve the following case:

 

I have to find a match in a list and the example is:

 

List of words:

------------------

PEPPERCORN

CORN MEAL

CORN OIL

CORN

 

The pattern match word is "CORN" so my result should return CORN MEAL, CORN OIL, CORN but NOT PEPPERCORN.

 

I built a sample workflow that uses both REGEX tool and a formula that uses REGEX_Match. REGEX tool returns correct results but I am not sure how to pass a dynamic string there instead of hard coding my pattern.

 

REGEX_Match does not match CORN MEAL, CORN OIL. It matches CORN with CORN only. How can I make this function work for 

CORN MEAL, CORN OIL (but not PEPPERCORN)?

 

I'm more leaning towards using REGEX_Match solution.

 

I'm attaching my workflow.

 

Thanks in advance!

K.

 

11 REPLIES 11
ddiesel
13 - Pulsar
13 - Pulsar

Hi @Saumil!

 

Sorry for the slow response. I was on vacation. Here's one approach:

 

Capture.JPG2019-07-16_22-31-45.png

 

Let us know if this works for you.

DawnDuong
13 - Pulsar
13 - Pulsar

Maybe you can try a formula tool:

 

If Regex_Match([Original field], ".*CORN.*") then [Original field] else null() endif

 

or

 

If contains([Original field], "Corn", 1) then [Original field] else null() endif

 

the "1" is to ignore case, use "0" if you want case-sensitive test.

Labels
Top Solution Authors