Alteryx Designer Desktop Discussions

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

REGEX Match not providing expected outcome

Bruce_V
7 - Meteor

I have two RegEx tools in my workflow. The first one aims to identify if part of the string matches a criteria, for analysis purposes. The second one extracts that specific string part for reporting purposes. 

 

Here is the funny thing, the latter works fine the first doesn't work and provides FALSE values only. 

 

This is my RegEx for matching (this one doesn't work:

BEN \d{2,3}|BEN\d{2,3}

 

This is my RegEx for parsing (so this one works):

(BEN \d{2,3}|BEN\d{2,3})

 

Does anyone notice what might be going wrong? Note, it is not the brackets, I tried that one already. 

3 REPLIES 3
atcodedog05
22 - Nova
22 - Nova

Hi @Bruce_V 

 

I can guess what might be wrong in here. Your first scenario is a match, how match works is your input should be exact match to the regex. Eg: your regex will only match "BEN 23" but not "some text BEN 23 some text" to catch second scenario your regex should be something like below that it checks whether the regex is there in any part of string.

 

 

.*BEN \d{2,3}|BEN\d{2,3}.*

 

 

 

In parse it tries to find whether the regex is there in part of the string even in between hence it would work for both scenarios and captures.

 

Hope this helps 🙂

Bruce_V
7 - Meteor

Thanks, I'll try your solution. 

atcodedog05
22 - Nova
22 - Nova

Hi @Bruce_V 

 

It was just a general brief idea. If you provide some sample data and expected output we can help you with a tailored solution for the scenario.

Labels