Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

String parsing based on different lengths

kmshannon
6 - Meteoroid

Hi,

 

Is there any way to parse a string based on different, but known-in-advance lengths?

 

For example:

I have the string "0123456789" and I want to extract 3 substrings of lengths 3, 5, and 2. 

This would result in the following 3 strings after parsing: "012", "34567", and "89".

 

Is there any way to do this in Alteryx?

6 REPLIES 6
Thableaus
17 - Castor
17 - Castor

Hi @kmshannon 

 

Does this work well for you?

 

capture.PNG

 

Cheers,

Thableaus
17 - Castor
17 - Castor

@kmshannon 

 

If you want any character, you can replace "\d" by "."

 

Cheers,

kmshannon
6 - Meteoroid

Hi Thableaus,

 

Thanks for the quick response. Unfortunately I am not getting the desired behavior from using your recommendation. As you can see in the attached screenshot, I am getting null values where the parsed strings should be. Let me know what you see here. Thanks!

Alteryx String Parse by Length.PNG

 

Thableaus
17 - Castor
17 - Castor

@kmshannon 

 

Don't split up the parsing groups with a space.

 

Everything needs to stick together

 

(.{3})(.{5})(.{2})

 

Cheers,

MarqueeCrew
20 - Arcturus
20 - Arcturus
(\d{3})(\d{5})(\d{2})

If you use this for your regular expression, all should be better.

 

cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
kmshannon
6 - Meteoroid

Ah good catch. That worked. Thank you so much!!!!

Labels