Alteryx Designer

Find answers, ask questions, and share expertise about Alteryx Designer.
Register for the upcoming Live Community Q&A Session - and don't forget to submit your questions for @DeanS regarding the future role of analytics here.
SOLVED

Regex Parse splitting incorrectly

Highlighted
6 - Meteoroid

I am using the regex tool to parse a string instead of using the split tool because the delimiter has to be a space and a hyphen (hyphens can be used later in the string without a space so it has to include the space to be a delimiter): Here is the regex that I am using

 

^(.*)-\s(.*)-\s(.*)$

 

Most of the time it works, but about 5 out of 200 are not parsing correctly. I attached a small sample with the labels replaced of the input and output that I am getting.

 

Any thoughts on why it would not be parsing in these few instances would be welcomed!

 

 

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

Hi @mekopf 

 

When I try with your example, I get exactly what you expect.


I can imagine something is going on with your LABEL names that you're actually changed to generic names.

 

Would you have an example of these ones so we can analyze the string itself? Cause I'm pretty sure that this is the issue.

 

Cheers,

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

@mekopf 

 

One of my guesses is that a few of your labels contain a hyphen and a space

 

Like, for example, Alcatel - Lucent, something like that.

 

Cheers,

Highlighted
Alteryx Certified Partner

Hi @mekopf 

 

As @Thableaus mentioned, the REGEX you provided does seem to work. However, I'd suggest making some adjustments. Use + instead of * to ensure it matches at least 1 character. I also noticed that there's an additional space before the hyphen that your pattern was not looking for. 

 

^(.+)\s-\s(.+)\s-\s(.+)$

 

Highlighted
6 - Meteoroid

I went through the later part of the label that I had to remove and found that in about 1%, the users inputting the data had manually added a hyphen and a space which was throwing off the formula. We will have to clean up the data input to make it work correctly.

 

Thanks for the help!

Labels