Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

General Discussions

Discuss any topics that are not product-specific here.
SOLVED

Remove Suffix From Name

emenendez2
7 - Meteor

Hello!

 

I need to remove the portion of the Name that shows "(On Leave)"

 

Ex. We have a name which may show as Elizabeth Menendez (On Leave), but I would like the name to show as Elizabeth Menendez on the output.

 

I attached a test WF showing the formula I added to my WF but it's only removing the text "On Leave" and the () parenthesis are still showing.

 

Can someone please provide a suggestion on how I can remove the entire "(On Leave" portion from each name?

 

Thanks!

 

4 REPLIES 4
npacheco
5 - Atom

Hey,

So Regular Expressions (RegEx) requires an "escape character" to denote differences in special characters vs commands.

The "\" character is placed before the "(" and ")" to denote that they're not part of the RegEx commands.

I would recommend using the RegEx tool and as follows:

npacheco_0-1678292296964.png

 

binuacs
21 - Polaris

@emenendez2update your formula like below

REGEX_Replace([Primary Contact], "(.*)\(.*", "$1")
emenendez2
7 - Meteor

Hello! @npacheco @binuacs 

 

Thank you both for your suggestions! I tried both methods and got the correct output showing the name without "(On Leave)".

 

@npacheco I decided to go with you version, because the method from @binuacs showed a red triangle on the upper right corner of the cell output saying "this contains trailing spaces" and I was not sure what impact that would have.

 

Both were great, thank you!! 

 

 

binuacs
21 - Polaris

@emenendez2 that is the leading space, use the Trim() function to eliminate the spaces

 

Trim(REGEX_Replace([Primary Contact], "(.*)\(.*", "$1"))
Labels