Skip to main content
Question

RGEX Deleting or Replacing anything after underscore


Forum|alt.badge.img

I still struggle with RGEX which is what I suspect is needed to accomplish a find and replace. I assume that StringReplacer is the transformer I should use, but I struggle with the REGEX.

I have 2 columns of data with various underscores followed by some character or words. Typically, it is _V and if was just that then I figured out how to do that, but I also have as other examples: VTF_SH_NNN_V, MSA_Name_NNN, and others. So, basically, I jut want to find "_ and delete it and anything after it. Can someone help me with the RGEX code. Thanks.

2 replies

Forum|alt.badge.img
  • Author
  • May 22, 2016

I think I figured it out: I used the RGEX Expression: \\_.+

I used the following resources to help me parse out my question in case anyone is stuck like I was not really having used REGEX before. https://regex101.com/#pcre

This video helped: https://www.youtube.com/watch?v=koyjj87QbXg


takashi
Influencer
  • May 23, 2016
dshaw wrote:

I think I figured it out: I used the RGEX Expression: \\_.+

I used the following resources to help me parse out my question in case anyone is stuck like I was not really having used REGEX before. https://regex101.com/#pcre

This video helped: https://www.youtube.com/watch?v=koyjj87QbXg

Hi @dshaw, congrats you got a regex solution. Since the underscore '_' doesn't require escaping in regular expressions, you can remove the first backslash from your regex. This regex should work for you as well: _.+


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings