Alteryx Designer Desktop Discussions

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

How to Insert a Delimeter in every X character in a coloumn

Barnana
5 - Atom

I have a long string of values in different rows. I need to insert a delimiter after every 4th character    ( / ) there is no other consistency in the values (i.e. case, what the character is). I am trying to use the RegEx tool but can't figure out how to specify to insert the delimeter in this position.

 

Example:

String looks like this - 1040202

                                   0990930

                                   1141030

Needs to come out like this: 1040/202

                                             0990/930

                                             1141/030

.

 

Thanks in advance!

7 REPLIES 7
JosephSerpis
17 - Castor
17 - Castor

Hi @Barnana I mocked up a workflow that shows how to do this. Let me know what you think?

messi007
15 - Aurora
15 - Aurora

Hello,

 

Hope this will help.

I attached the workflow as well.

 

messi007_0-1604500690581.png

Regards,

jdunkerley79
ACE Emeritus
ACE Emeritus

Hi,

 

If you want to do it with the RegEx tool, then something like:

jdunkerley79_0-1604501778964.png

should do what you want

 

It identifies the first 4 characters and stores them into $1

It then replaces them with $1/ which adds the separator

 

vizAlter
12 - Quasar

Hi @Barnana — You can write just a single line expression in the Formula tool as well:

 

 

REGEX_Replace([Field1], "(^....)", "$1/")

 

vizAlter_0-1604520083041.png

 

FYI:

^  sign asserts position at start of a line (beginning point)

.   sign matches any character (4 dot signs for reading 1st 4 characters)

 

 

If this assists please mark the answer "Solved", if not let me know!

 

 

grazitti_sapna
17 - Castor

Hi @Barnana,

 

Is this what you are looking for?

 

grazitti_sapna_0-1604553186194.png

 

Sapna Gupta
atcodedog05
22 - Nova
22 - Nova

Hi @Barnana 

 

Here is my take on it

Formula:

REGEX_Replace([Text], "(\d{4})(\d{3})", "$1/$2")

 Output:

atcodedog05_0-1604555106590.png

Hope this helps 🙂

Manvi1996
5 - Atom

Hyee , I am posting the solution hope it will solve your problem 

Manvi1996_0-1604558320439.png

 

Labels