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.

Divide String ABCadMunicipalMarketBudget to ABCad Municipal Market Budget

saachitalwar
8 - Asteroid

How can I transform a string like the aforementioned method

13 REPLIES 13
alexnajm
18 - Pollux
18 - Pollux

Is there consistent logic to determine how the split should occur? Right now, it only seems like you could do it on word length (i.e. first word is 5 digits, second word is 9 digits, etc.)

BS_THE_ANALYST
15 - Aurora
15 - Aurora

@alexnajm Perhaps, ignore any initial sequence of capital letters, but the splits would be at every Capital letter from there forward?

 

All the best,

BS

All the best,
BS

LinkedIN

Bulien
alexnajm
18 - Pollux
18 - Pollux

Fair shout @BS_THE_ANALYST ! Let see what @saachitalwar has to say 😊

OllieClarke
15 - Aurora
15 - Aurora

@saachitalwar 
Try

 

Regex_replace([field],'([a-z])([A-Z])','\1 \2\',0)

 

This should put a space between lowercase and capital letters

BS_THE_ANALYST
15 - Aurora
15 - Aurora

@saachitalwar If there's multiple words using @OllieClarke logic, I'd do something like this:

Just remember to uncheck "CASE INSENSITIVE" options in the regex tools, or if you're using a formula like Ollie, you may need to add an additional parameter into the regex_replace tool to allow it to be case sensitive. It's case insensitive by default: REGEX_Match(String,pattern,icase) https://help.alteryx.com/current/en/designer/functions/string-functions.html#idm45439286131424 

 

 

([A-Z]+[^A-Z]+)

 

 



Screenshot 2024-04-29 093234.png

All the best,
BS

LinkedIN

Bulien
OllieClarke
15 - Aurora
15 - Aurora

Good point @BS_THE_ANALYST, I've edited my formula to include the case insensitivity flag turned off

saachitalwar
8 - Asteroid

Hi, this is very close to the string I want. but the output is like ABCad M\unicipal M\arket B\udget.

How can the \  marks be removed

ChrisTX
16 - Nebula
16 - Nebula

Try this:  Regex_replace([Field1],'([a-z])([A-Z])','$1 $2',0)

 

saachitalwar
8 - Asteroid

this worked!

 

there are some other instances as well like ABCad100%TreasuryBudget  and ABCadU.S.Budget

 

Can you help with thi s please

Labels
Top Solution Authors