Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Announcement | We'll be doing maintenance between 9am-11am MT on Saturday, January 25th, which may impact your experience. Thanks for your patience as we work on improving the community!

Use Regex to split string


Dear all,


I run into a problem when splitting a string and regrouping it based on different criteria. I tried various formulas and workflows and I am still stuck to find a structured workflow. 


The initial data looks like :

001ABC 123 M @#
001ABC 798 M @#
001ABC 7 @#
001ABC @
002F 421 #
003GHJK 433 @
003GHJK @


What output should be is :


001ABC123 M@#
001ABC 798 M @#
001ABC @
003GHJK 433@
003GHJK  @


Many thanks for your input.

^([^ ]+) (.*?) ?([^ ]+)$

should do what you need.


The first column will be up to the first space. The last column will be from the last space.

The middle column will only be filled if there is a middle block


Sample attached


Thank you ! This looks great!