Alteryx Designer Desktop Discussions

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

REGEX REPLACE removing all numbers in the beginning of a string

fitch1892
7 - Meteor

I want to remove all the numbers in front of the string in Column B, but stopping at the first letter. Im currently using REGEX_Replace([field 1], '^\d+\s*', '') , but its not exactly what i want. Be in mind i have a large data set im working with, so below are just some examples of my data. 

 

Column A     |   Column B

     A             |    47477474 g-500 bucket

     N             |    4744 g500

     Y             |    4744 Lamar Heart 

     T             |    05' Penny Stock

 

 

What I want 

Column A     |   Column B

     A             |    g-500 bucket

     N             |    g500

     Y             |    Lamar Heart 

     T             |     Penny Stock

5 REPLIES 5
IraWatt
17 - Castor
17 - Castor

Hey @fitch1892,

You can use this Regex to do this:

 

\w+ (.*)

 

IraWatt_0-1657300006542.png

Full explanation below. 

 

 

IraWatt
17 - Castor
17 - Castor

@fitch1892 To explain how my answer works 

\w+ 

This will match with any word characters at the beginning of the text.

(.*)

This creates a group with all the other characters in the text.

IraWatt_0-1657300150185.png

I then replace the entire text with just what is in the group $1 (references the first group).

for more information on Regex check the Alteryx interactive videos found here: Interactive Lessons - Alteryx Community

 

Any questions or issues please ask :)
HTH!
Ira

 

 

Emmanuel_G
13 - Pulsar

Hi @fitch1892 ,

 

Find a test attached with Regex_Replace just as you begin.

 

Let me know if it works as you want.

 

More details about Replace using regex : https://community.alteryx.com/t5/Base-de-Connaissance-Francais/Maitrise-de-l-outil-Regex/ta-p/321434

 

Cheers,

 

Emmanuel_G_0-1657300650979.png

 

 

 

PhilipMannering
16 - Nebula
16 - Nebula

I think - without trying it - you could also do something as simple as,

TrimLeft([Field1], "0123456789' ")
Emmanuel_G
13 - Pulsar

Very nice trick @PhilipMannering , I hadn't thought of that.🙂

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels