Alteryx Designer Desktop Discussions

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

Regex is and is Not Working-Baffling Issue

KAFord
8 - Asteroid

I am absolutely stumped with two workflows that I have. They are both the same workflows, I took the one that works and copied it to work with a second set of data that is identical. The problem is, that my parse isn't working on the new set but it works fine on the first set. Here is an example:

 

First set of data:

 DEPLOYMENT_NAME
617. Standard Course Evaluation_201820-12

 

My Regex looks like this:

Regex-Parse.png

After this parse, I end up with a field called Survey ID that has 617 in the field since it parsed out the first three numbers, like I wanted it to.

 

My second set of data looks like this:

DEPLOYMENT_NAME
625. Research Classroom Course Eval_201820-1

 

I am using the same parse but it is not parsing out the first three numbers. I am absolutely stumped! I would appreciate if someone might be able to shed some light on this. I have a third set of data where the deployment name has different wording, like these two do and it works fine. It is literally this one set out of the three that will not parse. I am unable to share my workflows since they contain confidential information but it is literally this data that I am trying to parse and I want the first three numbers.

 

Thanks!

7 REPLIES 7
fmvizcaino
17 - Castor
17 - Castor

Hi KAFord,

 

See attached workflow for a suggestion in how to accomplish it.

 

Only for explaining what's going wrong with your regex.

 

(.+d) = 1 or more character until finds a letter d

In your first set of data, what is happening is that it is parsing '617. Standard', but since you selected a string with size 3, it is truncating the first 3 character of the parse.

 

Hope it helps.

Fernando Vizcaino

KAFord
8 - Asteroid

Hi Fernando --- in my first example, it is doing exactly what I want it to do, it is parsing out the first three numbers, that is exactly what I want.

 

In the second example, it will not parse out the first three numbers and I cannot figure out why.

 

I have a third set of data that looks like this:

624. Field Experience Course Evaluation_201820-4

 

The third set of data also parses out the first three numbers, just like I want.

 

I will review your file but the fact that the data is identical, it just comes from different class types which explains the different naming convention in that field, does not explain why the parse works in two workflows but does not work in the other.

 

Thanks!

KAFord
8 - Asteroid

Hi Fernando --- this works perfectly, I'm just stumped as to why my Regex works with two of my files and doesn't work with the third. I've modified to include your coding. Thanks for the quick response. I'm still baffled, but at least the Regex is working.

 

Thank you SO much!

fmvizcaino
17 - Castor
17 - Castor

Hi KAFord,

 

From the Regex you constructed, the reason it may be not working in another dataset is because it is only going to work if the field from this other dataset has the letter 'd' in the text. So, for every line that has a 'd' anywhere, it is going to work.

 

Fernando V.

KAFord
8 - Asteroid

Thank you Fernando.  That actually makes sense since two sets have that and the set that isn't working does not. I'm still learning Regex and I appreciate the example and the time you took to explain it to me.

 

Appreciate you!

fmvizcaino
17 - Castor
17 - Castor

Hi KAFord,

 

Since you are learning Regex, I would like to suggest this site https://www.regexpal.com/

 

There you can test the regular expressions and see what the results are like.

 

Fernando V.

KAFord
8 - Asteroid

Thanks for the link, I will definitely be using it. I'm taking the Regex course on Monday at the Alteryx conference so I'm hoping to learn and add more to my understanding of writing the correct syntax.

Labels