Skip to main content

Hi,

I keep going in circles and can’t think of an easy way to do this. Has anyone got any tips
Basically, I have an attribute such as “TEST_240829_MLS_5_316460_5816230”

What I what to do is remove “_316460_5816230” from the end. I’m wanting it to adaptively remove this part of the string from several thousand inputs.

Normally I would use the attribute trimmer however the length of this part of the string will change (not a constant thing I can remove). This part of the input string does always start at the second last occurrence on the “_” delimiter and go until the end. The amount of delimiters is not constant in the part of the string I want to keep though, so I also can’t use the attribute splitter and then rebuild the part I want from the parts of a list

Is there an easy wany to do this?

Can use a RegEx solution to define RegEx Group 1 as being the text in front of the second last “_” and keep just this portion.

^(.+)_.*_.*$

 

Input

 

StringReplacer Output

 


I knew there was a way I’d done before. Thanks @bwn !


Reply