Hi Alteryx Community,
How can I replace all of the numbers between a parentheses which contain a number to nothing. For example:
CURRENT ----> RESULT...
Test company 123 (100%) ----> Test company 123
Test company 456 (i.e. tc456) (200%) ----> Test company 456
Test Company (TC) Holding AB (46,714,779 COMMON_SHARES) ----> Test Company (TC) Holding AB
So to further clarify the text I have to the right of ----> would be the current state, and the text to the right of ----> is what I would how to achieve after a regexreplace.
Thanks so much for your help! Please let me know if you need further clarification.
Solved! Go to Solution.
Would something like this work?
Trim(Regex_Replace([Field1], "\([^)]*?\d[^)]*?\)", ""))
Basically it means if it finds a number between parenthesis, we should replace this full expression (including the parenthesis), with nothing.
Use this expression with the Trim function in the Formula Tool.
Cheers,
Hello Regex my old friend...
[(]\d+.+[)]|[(].+\d+.[)]
That should do it.
I've attached the workflow. Let me know it doesn't work.
M.
Thank you so much for your reply..very close - didn't work for :
Test Company, LLC (0 COMMON_SHARES) Test Company2, LLC (0 COMMON_SHARES)
This worked!! Thank you so much for your help 🙂
Hi @mvtthewcornelison ,
It works for me.
Unless I've misunderstood what you need. I thought you wanted anything in parentheses that contained a number to be removed?
M.
@mceleavey I was hoping the output would be:
Test Company, LLC (0 COMMON_SHARES) Test Company2, LLC (0 COMMON_SHARES) ----> Test Company, LLC Test Company2, LLC
I think I could have been more specific in my instructions / ask. And I should have included this record in my example. My apologies! Thanks for all your help.
Hi @mvtthewcornelison ,
I see. I n that case, you just need to make the clause "greedy":
[(]\d+.*?[)]|[(].*?\d+[)]
New version attached.
M.