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

Adding spaces twice in between string

kauser
8 - Asteroid

Hello, 

how can i adding spaces twice in between a sting line - 

 

Current output - 

 

ABCD1234-05Output 

 

Expecting Output- 

 

ABCD 1234-05 Output 

3 REPLIES 3
Qiu
21 - Polaris
21 - Polaris

@kauser 
you meant you want to insert space between Group of Character and Number?

 

NeoInfiniTech
11 - Bolide

Hello @kauser,

 

Normally, with the sample string you shared, it would require a simple RegEx pattern such as 

([A-Z]+)([0-9-]+)([A-Z]+)

replaced with 

$1 $2 $3

to achieve the output required.

 

With that being said, there are certain questions that should be answered for a healthier parsing method:

 

1. Does the first part contain in some rows: Special characters, numbers [0-9] or non-English characters? (First part containing numbers might make it impossible to build a RegEx pattern for this scenario based on where the numbers take place in the first part)

2. Does the second part contain in some rows: Other characters than numbers [0-9] and dash ("-") character?

3. Same question for the first part applies to last part.

 

Without a longer sample with more rows, it might not be possible to build a correct RegEx pattern.

 

I am providing a sample workflow as an attachment, but please be aware that it was built on the sample string so it is a high probability that it won't be able to parse all rows correctly.

Raj
16 - Nebula

@kauser try this
REGEX_Replace([FieldName], "([A-Z]+)(\d+)(-\d+)([A-Za-z]+)", "$1 $2$3 $4")

Mark done if solved.

Labels
Top Solution Authors