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

Extract text from a string

YizhouZhang
5 - Atom

Hello,

 

I want to extract any text in between "P " and " (" and split them into different rows from a string. I was trying to use the RegEx tool, but can't figure out how to extract the text without that " ("

 

String: P Pizza (ODP)-10P Flower (EJW)-40, P Brain (VID)-12P Earth (LIW)-20

Regular Expression: [^%]+[(]

Result:

Pizza (

 

Flower (

Brain (

Earth (

 

After this, I will have to write a formula to get rid of " ("

Is there a way to get rid of " (" in one setting when I use the RegEx tool?

 

Thank you!

 

Yizhou

3 REPLIES 3
MarqueeCrew
20 - Arcturus
20 - Arcturus
Can you try:

P\s([^\(]+)\(

Or something like it.

Cheers,

Mark
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Thableaus
17 - Castor
17 - Castor

Hey @YizhouZhang

 

Try this Regular Expression:

 

(?:%)(.+?)(?:\s|\(|$) - edit: without the trailing spaces at the end.

 

It worked fine here.

 

You can also read this article on RegEx, it helps a lot to understand how the Tokenize mode functions.

 

https://community.alteryx.com/t5/Alteryx-Knowledge-Base/Tool-Mastery-RegEx/ta-p/37689

 

Cheers,

YizhouZhang
5 - Atom

Thank you very much!

Labels