Alteryx Designer Desktop Discussions

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

Regex replace? Need to extract a text after certain character... Help!!!

kkkim
8 - Asteroid

Hi, All:

I need to extract a text immediate following " - ". Any suggestions on how to implement this? Attaching an example of original text and outcome text.

 

Thank you for your help!!!!

 

Original:

JohnSmith - Blue Is Cool

 

Outcome:

Blue

4 REPLIES 4
DataNath
17 - Castor

If your string will always follow this kind of format then you can use the RegEx tool in parse mode with the following expression:

 

-\s(\w+)

 

If the space won’t always be there after the - then use:

 

-\s?(\w+)

kkkim
8 - Asteroid

Thank you! That worked perfectly!

Garabujo7
Alteryx
Alteryx

You may use the almighty text to columns:

 

Garabujo7_0-1664474490810.png

 

 

Garabujo7_1-1664474510652.png

 

 

Gabriel

Garabujo7
Alteryx
Alteryx

And if would like to try regex:

 

-(.+)

 

Garabujo7_0-1664474892044.png

 

That will bring you everything after the -

 

There's also a nice cheat sheet that you could use in the regex tool as well.

 

Garabujo7_1-1664474970118.png

 

 

Gabriel

Labels