Alteryx Designer Desktop Discussions

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

Remove Last Characters

fjlorenzo
8 - Asteroid

Hi,

 

I have the below set of values. How can I remove the "on ROLENAME" and "on TEAMNAME" from each cell.

 

WAM Control - Role - Autosys-JobManager-Team on ROLENAME
WAM Control - Team - Web Dev Corp Finance on TEAMNAME

 

Thank you for your help.

 

Regards,

Florence

11 REPLIES 11
OllieClarke
15 - Aurora
15 - Aurora

Hi @fjlorenzo 

RegExReplace([Field],' on (ROLENAME|TEAMNAME)$','')

will remove the " on ROLENAME" or " on TEAMNAME" if they come at the end of the string

 

Hope that helps,

 

Ollie

BrandonB
Alteryx
Alteryx

Does every line have an 8 character thing you need to remove? If this is the case you can say LEFT([ColumnName], Length([ColumnName])-8)

 

If you want to remove rolename and teamname you could do Replace([ColumnName], " ROLENAME", "") and Replace([ColumnName], " TEAMNAME", "")

ShankerV
17 - Castor

Hi @fjlorenzo 

 

One way of doing this.

ShankerV_0-1677265626962.png

BrandonB
Alteryx
Alteryx

@OllieClarke I love the fancy regex solution. Kudos!

fjlorenzo
8 - Asteroid

Thank you ShankerV. Can you explain did this "(.+)(\s\w{2}\s\w{8})$" removed those words?

fjlorenzo
8 - Asteroid

Thank you BrandonB. Yes,every line has 8 characters that needs to be remove at the end of the string.

fjlorenzo
8 - Asteroid

Thank you OllieClarke.

fjlorenzo
8 - Asteroid

Thank you all for all your suggestions. All are good.😊

ShankerV
17 - Castor

Hi @fjlorenzo 

 

Please be informed that, the items within () are called group.

 

I have segregated the input in 2 groups.

 

First group - (.+)

Second group - (\s\w{2}\s\w{8})

$ demotes to end of the string

 

Then in the output method I have used the Replace option, so that first group is written in the cell.

 

Note: 

\s denotes space

ShankerV_0-1677266733447.png

 

Input was:

ShankerV_0-1677266821434.png

 

Output is after removal of words.

 

ShankerV_1-1677266854298.png

 

Many thanks

Shanker V

Labels