ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more 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
binu_acs
21 - Polaris

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

binuacs_0-1685483501100.png

 

binu_acs
21 - Polaris

@cslagle005 using the Regex_Replace function

binuacs_1-1685483667948.png

 

alexnajm
19 - Altair
19 - Altair

@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