We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

How to add a space between the quarter and year, for example "Q12023" becomes "Q1 2023"

cslagle005
6 - Meteoroid

Hi all, beginner here and I'm striking out here trying to figure out the right RegEx formula to do this.  I have a bunch of columns that look like the below example and I want to add a space in between the Q# and YYYY. 

 

I've tried using the Formula tool with "REGEX_Replace([Name], '(\w\d)', '($1) " "') " but that isn't doing anything.  Any advice?

 

Example input:  

Q12023Q22023Q32023

 

Desired output:

Q1 2023Q2 2023Q3 2023

 

4 REPLIES 4
binuacs
21 - Polaris

@cslagle005 This can be achieved with the help of the Left() and Right() functions

binuacs_0-1685483501100.png

 

binuacs
21 - Polaris

@cslagle005 using the Regex_Replace function

binuacs_1-1685483667948.png

 

alexnajm
18 - Pollux
18 - Pollux

@cslagle005 try this RegEx instead: REGEX_Replace([Name], "(\w\d)(\d{4})", "$1 $2")

cslagle005
6 - Meteoroid

Thanks all, I really appreciate all your replies!

Labels
Top Solution Authors