Regex to find the last underscore and all text that follows it

My sample text would be something like this list


and I would like to be left with (with a notepad++ regex find and replace)


I am just looking for the Regex as I understand notepad++ :-)

Thank you!
K BAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
The regex in the comment that you posted (and deleted) should work, although you should also be able to simplify that to...


Open in new window

I don't know Notepad++ so I am not sure exactly how it would apply a regex but you may need to specify options to make it a "multiline" match and to match "globally" or all occurrences. Also, it may be obvious, but the replacement string should be just empty.
Bill PrewIT / Software Engineering ConsultantCommented:
I confirmed that _+[^_]*$ works in Notepad++ Replace as a REGEX, looks like a winner to me.

K BAuthor Commented:
Thank you for your replies.. it seems to not stop at the end of the line and highlight four additional lines (randomly?)
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
And here is a test of the above regex...
K BAuthor Commented:
Here is a better example... perhaps I should have given this to begin with..


Open in new window

mccarlIT Business Systems Analyst / Software DeveloperCommented:
It's very hard with the blurred image to know what is going on, but I understand that there might be data that you can't share with us!

Does the regex work with the original sample text? Can you come up with some sample text that DOES exhibit the issue that you have but that is non-sensitive data so that you can fully post it here?
Bill PrewIT / Software Engineering ConsultantCommented:
What's different compared to test data you posted?

K BAuthor Commented:
Our comments just posted at the same time :-)
mccarlIT Business Systems Analyst / Software DeveloperCommented:
Ok, try this...


Open in new window

And a test link...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
K BAuthor Commented:
thank you!
mccarlIT Business Systems Analyst / Software DeveloperCommented:
You're welcome!
Bill PrewIT / Software Engineering ConsultantCommented:
Try this:


Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Regular Expressions

From novice to tech pro — start learning today.