Alteryx Designer Desktop Discussions

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

Striping characters starting from 2nd underscore

rjbrsh
7 - Meteor

I wanted to strip off the character starting from the 2nd underscore.

Example:

abc.2099-21-11_100101_299-09-76

Output I'd like to be:

abc.2099-21-11_100101

Any help will be very much appreciated.

 

Thank you. 

5 REPLIES 5
RishiK
Alteryx
Alteryx

@rjbrsh check out the attached sample workflow.

You may also be able to get ideas from this article:

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Remove-everything-after-the-first-hyph...

Ben_H
11 - Bolide

Hi @rjbrsh 

 

There are a few ways to do this, one way is to use REGEX -

 

Something like REGEX_Replace([Input],"(.+_.+)_(.+)","$1") should work, just replace [Input] with your field name.

 

Regards,

 

Ben

Hollingsworth
12 - Quasar
12 - Quasar

A non-RegEx formula would be:

 

left([Field],length([Field])-findstring(reversestring([Field]),'_')-1)

John Hollingsworth
Clear Channel Outdoor
messi007
15 - Aurora
15 - Aurora

@rjbrsh,

 

You can use regex tool as well 🙂

 

messi007_0-1620313831873.png

Attached the workflow,

 

Hope this helps!

Regards,

rjbrsh
7 - Meteor

This worked out for me. Thanks Ben, appreciate your help. 🙂

Labels