community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE
SOLVED

Split a string field into two fields using RegEx / Text To Columns

Meteor

Hi,

 

I want to split the following string field into 2 (by separating the number and words on the first instance only). See the following data:

 

4759-05-71 AB(CD)

1090-43-000-000Petty Cash:Admin

1990-43-000-000Petty Cash: Admin - #4201:2Admin

1077-00-00 HDK Concentration (Ending 3873)

 

As you can see there aren't any set structure to the string. But I would like the following:

 

Column 1                                     Column 2

4759-05-71                                  AB(CD)

1090-43-000-000                         Petty Cash:Admin

1990-43-000-000                         Petty Cash: Admin - #4201:2Admin

1077-00-00                                  HDK Concentration (Ending 3873)

 

Thank you so much for your help in advance.

Alteryx Certified Partner
Alteryx Certified Partner
Try this formula:

Regex_replace([field],"([0-9\-]+)(.*)",'$1|$2')

You can then parse it. If you're familiar wit he the regex tool you could use that and save a tool.

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Quasar

Here is the sample workflow for your case.  Hope this is helpful. 

 

Input.PNGInputworkflow.PNGWorkflowResults.PNGResults

Meteor

@MarqueeCrew,

 

Thank you. Your Regex formula works perfectly. What will be a good website that you recommend to learn regex expression? It's such a powerful tool. 

Alteryx Certified Partner
Alteryx Certified Partner
Regex101.com

Try also YouTube with Alteryx and Regex. You might like some of my Marqueecrew content and want to subscribe.

Cheers,

Mark
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Quasar

@calvinwong, I am curious to know if you tried my solution-a length workflow though 

Meteor

@ponraj,

 

Thank you for your help. I did look at your workflow and it did the work as well (just in a longer way). :) 

Labels