Free Trial

Alteryx Designer Desktop Discussions

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

Parsing String with RegEx

knnwndlm
8 - Asteroid

Hello,

Could somebody please help me parse the following string into multiple columns using RegEx?

I have a column as follows:
CA RATE (1/1/13-12/31/16)
NZ RATE (1/1/16-3/31/17)
NZ CURRENT RATE (1/1/20)
CA CURRENT RATE (4/1/21)

 

What I want to get is as following three columns:
CA RATE                      1/1/2013     12/31/2016
NZ RATE                      1/1/2016      3/31/2017
NZ CURRENT RATE   1/1/2020     12/31/2022
CA CURRENT RATE   4/1/2021     12/31/2022


Thank you!

Konn

6 REPLIES 6
Luke_C
17 - Castor
17 - Castor

Hi @knnwndlm 

 

Here's one way (no need to use regex).

 

  1. Split data on parenthesis
  2. Split data on hyphen (date)
  3. Use datetime formulas to update the dates to the desired format, or fill in empty date with 12/31 of current year. 

Luke_C_0-1651695530673.png

 

 

DataNath
17 - Castor
17 - Castor

You'll just need to chuck a formula or DateTime tool on the end to format the dates how you'd like! Workbook attached.

 

DataNath_0-1651696334619.png

 

messi007
15 - Aurora
15 - Aurora

@knnwndlm,

 

Another way with RegEx and dateTime :

 

messi007_0-1651696609577.png

Attached the workflow,

Regards,

alisonpitt
11 - Bolide

This will get you the 3 columns without having to add the 12/31/2022 ahead of time, but you'd then need to add in a formula and datetime tool to clean up the nulls and the formats:

 

[A-Z\s]{1,}(?=\ \()|\d*\/\d*\/\d*

 

Spoiler
regex.png
binuacs
21 - Polaris

@knnwndlm Another way of doing this

 

binuacs_0-1651699447747.png

 

knnwndlm
8 - Asteroid

Thank you All for your quick reply.  This is incredibly - the support and speed of the replies.  Have a wonderful day!

Labels
Top Solution Authors