Free Trial

Alteryx Designer Desktop Discussions

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

Regex Question: how to extract text only from a text number mixed field?

marlline
8 - Asteroid

Hi, I need to extract text from a field mixed text with number, for example ABC123456 I need ABC

The problem is that length of text varies from record to record. For example:

ABC123456 (ABC is needed)

ABBC554466 (ABBC is needed)

ABBBB457888 (ABBBB is needed)

 

I think I could use Regex to parse it and I read some posts. When I try .*, it is not working.

Please help. Thank you!

11 REPLIES 11
jamielaird
14 - Magnetar
[A-Z]+ should do the trick
marlline
8 - Asteroid

Regex.JPG

 Why I still see "No Marked Groups Found"? Please help. Thank you!!!

David-Carnes
12 - Quasar

@marlline

You need to establish the marked group inside parentheses:  ([A-Z]+)

marlline
8 - Asteroid

your method works perfectly!!! Thank you very much!!!

MarqueeCrew
20 - Arcturus
20 - Arcturus

@marlline,

 

I'm a big RegEx fan.  I'm glad to see that this is working for you, but for the record I would like to propose an alternative solution for those that may not embrace regular expressions quite as quickly as you did.

 

ReplaceChar([Field1], "0123456789", '')

If you use the ReplaceChar function above, you can replace all numeric values with nothing.  I would compare that with another regular expression formula of:

REGEX_Replace([Field1], "[^A-Z]", '')

That expression will take all non-A to Z characters and replace them with nothing.

 

Alteryx gives you so many options.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
LordNeilLord
15 - Aurora

@MarqueeCrew

 

Can we get a customary speed comparison of RegEx vs ReplaceChar?

 

@LordNeilLord

Part time Tableau, Part Time Alteryx. Full Time Awesome


Data Lover

marlline
8 - Asteroid

Wow. This works great too. Thank you so much Lilo Bunny Foo Foo!

MarqueeCrew
20 - Arcturus
20 - Arcturus

@LordNeilLord,

 

I'm so happy that you asked.  The ReplaceChar() function is faster.  I didn't want to brag about .2 seconds on 300,000 records, but since you asked.  

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
LordNeilLord
15 - Aurora

@MarqueeCrew imo 0.2 seconds is a lifetime

 

And as I have mentioned before, I love you x

 

@LordNeilLord

Part time Tableau, Part Time Alteryx. Full Time Awesome


Data Lover

Labels
Top Solution Authors