Alteryx Designer Desktop Discussions

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

Parsing lines in a text file by character position

Nicholas_Kierstead
6 - Meteoroid

I want to parse a text file, so the data can be put into a table. Each line of the file is a long string with no regular delimiters. My thought was to use regex to tell Alteryx to parse out each line using ranges of character positions, for example (0-3), (4-10), (14-20), etc. ; but I can't seem to strip the string properly. 

 

If the line is: abc2lsdd22___eori38r 

<In the above example  '_' = space>

 

The string should end up parsed into the following blocks:

 

abc

2lsdd22

eori38r

 

Thx!

4 REPLIES 4
Emil_Kos
17 - Castor
17 - Castor

Hi @Nicholas_Kierstead,


I have used a combination of left + substrings to make it work:

Emil_Kos_0-1616533569931.png

 

marcusblackhill
12 - Quasar
12 - Quasar

Hey @Nicholas_Kierstead !

 

Don't know if you have many ranges but if at least these ranges don't change, you can work creating columns per range using formula tool with the formula SUBSTRING. Create one column for each range with the respective substring then you can do what you need with the data.

 

It's a way to do without regex at least.

 

Hope that helps!

Nicholas_Kierstead
6 - Meteoroid

Thanks!

danilang
19 - Altair
19 - Altair

Hi @Nicholas_Kierstead 

 

If the format is the same for each line , i.e. always 0-3, 4-10, 14-20, etc., you can import the file as a txt file and specify the columns in the input tool.  See this post for details.

 

Dan

Labels