Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Trim until alpha characters or trim first four characters

nwatzlaf
8 - Asteroid

Hi there,

 

I have several V-Strings that I am wanting to trim. The data comes in as seen below.

550-Apples

600-Oranges

780-Bananas

I want the output to read

Apples

Oranges

Bananas.

 

Any help on this is much appreciated.

Thank you!

 

3 REPLIES 3
PhilipMannering
16 - Nebula
16 - Nebula

Hi @nwatzlaf 

 

The easiest way is to use the Regex Tool set to replace with pattern,

\U

 

PhilipMannering_0-1614690526388.png

 

 

See attached

 

Philip 

nwatzlaf
8 - Asteroid

That worked thanks!!

I have a quick follow up question.. if I have something like 880-Apple Pies it spits out ApplePies. Is there a way to fix this spacing so it reads Apple Pies. There are a bunch of two/three word combinations with variable spacings. Is there a way to account for this?

PhilipMannering
16 - Nebula
16 - Nebula

Great!

 

You could try the same thing, except with the regular expression,

[[:punct:]\d]

to replace all punctuation and digits with an empty string.

 

Alternatively, using the Parse method you could use,

([\u\s]+)

To extract alpha characters and spaces.

 

If you only want to replace characters before the "apple pies" (and leave everything after) then you can use,

^[[:punct:]\d]+

 

If you end up with leading or trailing spaces, you can just use the Data Cleansing Tool.

Labels
Top Solution Authors