Missed the Q4 Fall Release Product Update? Watch the on-demand webinar for more info on the latest in Designer 24.2, Auto Insights Magic Reports, and more!
Free Trial

Alteryx Designer Desktop Discussions

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

Regex tool to separate after 1st hyphen

RajatRehria
8 - Asteroid

Hi all,

 

I using this syntax " ^(\d+)\s-\s(.+)$ " in the Regex tool (Parse) to separate data after first hyphen like below:

Col1                                          Col2                                Col3

31055 - Multiple Costs           31055                        Multiple Costs

 

however anywhere in my numbers is is decimal the values coming as null like below

Col1                                          Col2                                Col3

30144.4 - Purchase Costs         Null                                  Null

 

Desired output:

Col1                                          Col2                                Col3

30144.4 - Purchase Costs        30144.4                         Purchase Costs

 

kindly help in getting the desired result my modifying or with new syntax in the Regex tool

2 REPLIES 2
FinnCharlton
13 - Pulsar

HI @RajatRehria , here are a couple of ways to do it. In the Regex tool I've sorted out your formula - you needed to account for the possible full stops in the numbers. I've also given an example of using Text-to-Columns to do the same job. Hope this helps!

 

image.png

RajatRehria
8 - Asteroid

Thanks @FinnCharlton for the solutions.

Labels
Top Solution Authors