Alteryx Designer Desktop Discussions

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

Removing only the last set of parentheses

PickleRick
Meteoro

Hi guys,

 

I'm trying to figure out how to remove only the last set of parentheses and the text inside them from a paragraph of text and was wondering if you could help me?

 

Here's an example:

 

In this extremely (boring) example I need help (trying) to remove only the final set of parentheses (Remove me and the text as well)

 

Any help would be massively appreciated!

8 RESPUESTAS 8
RolandSchubert
16 - Nebula
16 - Nebula

Hi @PickleRick ,

 

if I've understood correctly, you want to remove the last parantheses only, meaning
In this extremely (boring) example I need help (trying) to remove only the final set of parentheses (Remove me)

=>

In this extremely (boring) example I need help (trying) to remove only the final set of parentheses Remove me

 

This is possible using string functions (ReverseString, ReplaceFirstChar). I've created a sample workflow. Let me know if it works for you.

 

Best,

 

Roland

PhilipMannering
16 - Nebula
16 - Nebula

Here's one way. I'm sure there are many more,

 

PhilipMannering_0-1584710105418.png

 

ReverseString(ReplaceFirst(ReplaceFirst(ReverseString([Field1]), '(', ''), ')', ''))

 

PickleRick
Meteoro

Hi @RolandSchubert thanks for the quick reply!

 

Sorry I should have made it more clear, the final parentheses and the text inside as well.

PhilipMannering
16 - Nebula
16 - Nebula

What about this?

 

regex_replace([Field1], '(.*)(\(.*\))(.*)', '\1\3')
VianneyM
Alteryx
Alteryx

hi @PickleRick,

 

What do you think of this: replace regex formula tool: REGEX_Replace([Data], "\([^)]+\)$", "")

 

 

VianneyM_0-1584710637960.png

 

Let me know if that works

 

Best,

Vianney

 

Best,
Vianney
RolandSchubert
16 - Nebula
16 - Nebula

Changed the workflow a bit. What do you think?

PickleRick
Meteoro

Thanks for all the great responses! After testing @VianneyM's worked best, thanks so much!

 

SX
Meteoro

It worked well for me. Thank you!

Etiquetas