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
20 - Arcturus

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

binuacs_0-1685483501100.png

 

binuacs
20 - Arcturus

@cslagle005 using the Regex_Replace function

binuacs_1-1685483667948.png

 

alexnajm
16 - Nebula
16 - Nebula

@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