Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Trim end of a string - help

mikedesena
7 - Meteor

Hello, here are examples of my data set:

Abcd Inc. (1234)

A Bcd llc (6789)

Abcd(4567)

 

I want to trim off the (####) from the right and keep no blank spaces. I have tried to follow regex examples but just do not understand it well enough yet. Can anyone help me out? The ending is always (####)

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @mikedesena 

 

try this formula

REGEX_Replace([Field1], "\s?\(.+\)", "")

 

Workflow:

atcodedog05_0-1630086323642.png

 

Hope this helps : )

mikedesena
7 - Meteor

I don't know how your sorcery works but it did. Could you do a step by step for me? As well i only have 2 errors now that there are trailing spaces. Those items were set up like:

 

ABC LLC   (1234)    (3 spaces)

XYZ Inc  (7894)   (2 spaces)

   
Should I just do a cleanse after? Thank you so much

mikedesena
7 - Meteor

I don't know how your sorcery works but it did. Could you do a step by step for me?

 

As well i only have 2 errors now that there are trailing spaces. Those items were set up like:

ABC LLC (1234) (3 spaces)

XYZ Inc (7894) (2 spaces)

 

Should I just do a cleanse after? Thank you so much

atcodedog05
22 - Nova
22 - Nova

Hi @mikedesena 

 

I have modified the formula to meet the requirement.

REGEX_Replace([Field1], "\s*\(.+\)", "")

 

Workflow:

atcodedog05_0-1630088277191.png

 

Explanation: 

Remove character pattern

 

\s* zero or more spaces

\( followed by open bracket

.+ any character inside bracket

\) followed by closed bracket.

 

Hope this helps : )

 

Labels