Help

Process a long text field to return an array based on conditions

Topic Labels: Formulas
Solved
Jump to Solution
616 3
cancel
Showing results for 
Search instead for 
Did you mean: 
aceesqd
4 - Data Explorer
4 - Data Explorer

I have a long text field that takes the food and the preference of the user.

Sample Input:

Burgers (Enjoy), Pasta (Ok), Seafood (Nope), Pork (Ok), Beef (Ok), Vegies (Enjoy)

 

I want to get all the texts that are "Enjoy"-ed by the user.

Expected Output:

Burgers, Vegies

 

What formula can I use to get this output?

1 Solution

Accepted Solutions
Sho
11 - Venus
11 - Venus

I tried to make an formula in Regex.
How does this work?

REGEX_REPLACE({Foods},"\\w*\\s\\((Nope|Ok)\\),?\\s?|\\s\\(Enjoy\\)\\s?","")

 

See Solution in Thread

3 Replies 3
Sho
11 - Venus
11 - Venus

I tried to make an formula in Regex.
How does this work?

REGEX_REPLACE({Foods},"\\w*\\s\\((Nope|Ok)\\),?\\s?|\\s\\(Enjoy\\)\\s?","")

 

This works fine for the sample data given but isn't working for 3-words. Thanks though!

Sho
11 - Venus
11 - Venus

I had not verified that case!
Update for multiple words

REGEX_REPLACE({Foods},"[\\w\\s]*\\s\\((Ok|Nope)\\),?\\s?|\\s\\(Enjoy\\)","")