Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Regex parse 2nd word

Timheijne
5 - Atom

Hi guys,

 

Looking for some help on the following, which should be doable using regex but I can't seem to get it right. 

 

Basically I need to get the second word out of a string that's build up like below example (in the example I would need the word "Room". 

 

Example: 

Ingredient: ROOM (25%), water, suiker, gecondenseerde magere MELK, cacaopoeder, TARWEBLOEM, magere cacaopoeder, soja-olie, EIGEEL?, invertsuiker, EI, gedroogd EIWIT, stabilisatoren (guargom, carrageen), zout, vanille-extract , rijsmiddel (natriumcarbon

 

 

I've tried using REGEX_Replace in a formule tool which creates a new column by using below syntax. Surprisingly, it does not work

 

REGEX_Replace([REGULATED_NAME], "(.*?) .*", "$1")

 

Anyone who has an idea on what the syntax should be?

3 REPLIES 3
Thableaus
17 - Castor
17 - Castor

Hi @Timheijne 

 

Try this

 

REGEX_Replace([Field1], ".*?\w+.*?(\w+).*", "$1")

 

Cheers,

Timheijne
5 - Atom

What the .... 

 

That's a record breaking solution, thanks a million!

 

Any suggestions on useful website to learn more on regex expressions?

 

Cheers!

Thableaus
17 - Castor
17 - Castor

@Timheijne 

 

https://www.rexegg.com is my favorite.

 

Also, strongly recommend you to read the "Mastering Regular Expressions" book. It explains with details how RegEX engine works, approaching different languages and "flavours".


Cheers,

Labels