Skip to main content
Question

RGEX Deleting or Replacing anything after underscore

  • May 22, 2016
  • 2 replies
  • 280 views

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

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
Celebrity
  • May 23, 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

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: _.+