Alteryx Designer Desktop Discussions

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

regex help - match all alpha characters until numbers

hamzam
8 - Asteroid

Hi,

 

I have some data like the following:


Abcd Efgh 1111

Abcd - Lmno

 

What I would like to get is just Abcd Efgh from the first row (get rid of all following numbers), and 

keep Abcd - Lmno

 

is regex the best way to do this? I tried a formula, but unfortunately, got all False

 

thanks.

6 REPLIES 6
mceleavey
17 - Castor
17 - Castor

Hi @hamzam ,

 

in your Regex tool try ([^\d+]+) and set up the parse function like this:

 

mceleavey_0-1602680704929.png

 



Bulien

estherb47
15 - Aurora
15 - Aurora

Hi @hamzam 

 

I would probably go a RegEx route with this one, although you could also use the Data Cleansing tool to remove all numbers.

 

Regex Replace will help you replace the numbers with nothing. If in a formula, you can use: Regex_Replace([Field],"(.*?)(\d*.*)","$1"). This marks everything before a number, and then after a number as distinct groups and replaces with just what's before the number.

 

Let me know if that helps. Cheers!

Esther

estherb47
15 - Aurora
15 - Aurora

@mceleavey 's solution is also elegant. You could use the Replace method in the RegEx tool as well. My method uses a formula tool.

 

I'd go parse if the numbers are important to keep, and Replace if you want to drop them.

 

Cheers,

Esther

hamzam
8 - Asteroid

thank you both @mceleavey and @estherb47 

mceleavey
17 - Castor
17 - Castor

You're very welcome, @hamzam 



Bulien

estherb47
15 - Aurora
15 - Aurora

You're welcome!!!

Labels