Hi,
How do I extract 'Belgium' from 'BE (Belgium)'?
I looked for solutions here but somehow, I am only getting 'BE' as output.
Thank you.
Solved! Go to Solution.
Hi @crazybeauti_ful,
can you explain the wider context? Do you always want to extract what is inside two brackets? Or do you always want to get the word Belgium? Can you provide a minimal sample?
If you can't provide a sample, here are some things you might want to look for: Regex and Formula.
Best
Alex
Hi @crazybeauti_ful, you could use the regex tool and construct relevant Regex expression to parse out the text between brackets. Attached is a sample to help you get started and expand upon.
Hi @grossal , I need to always get the data inside the parenthesis. I did try regex but I only got either the first 2 letters (outside the parenthesis) or 0.
HI @crazybeauti_ful,
here is a Regex to achieve it. It's a bit tricky because you have to escape the parenthesis and use them in order to catch it.
Output:
Regex:
Regex-Code for easy copy paste:
.*\((.*)\).*
Workflow attached. Let me know if it works for you!
Best
Alex
I like your thinking @dannyg !
Can someone explain the syntax for the solution, please?
.*\((.*)\).*
With all the parentheses I'm having trouble understanding the different pieces of it. Thanks!
Would love to have this formula saved somewhere but RegEx doesn't have that option. how would you wite this out for the Multi-Field Formula tool (where I can save the expression)?
PS - why don't the other formula-based tools have the ability to save expressions? I use the Multi-Field tool in cases where I could just as easily use a Formula tool only because I've got the expression I need save there.
@Rob48 this would be the formula for a column called "Field" :REGEX_Replace([Field], ".*\((.*)\).*", "$1")
it replaces the whole expression with the first capture group (a capture group is what is in () and $1 calls back to the first capture group), which would be Belgium in this case