Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In NotePad++, I want to remove everything after the third : character in a line.

So, the character would look like:


How would I get rid of the evenmoretext?

share|improve this question
use regex to search and replace – Shekhar Oct 7 '13 at 19:16
The text isn't the same every line. – Layne Oct 7 '13 at 19:19
check this post:… – Shekhar Oct 7 '13 at 19:21
Remove everything after the second ":"? – Axel Kemper Oct 7 '13 at 19:35

You can easily do so using Regexp search and replace

The regex to use is (put this into the Find what field on the Replace tab in the search window)


And into Replace with enter


(if you need the ending : too, add it to the end of the Replace with string)


What does this all do?

This matches the beginning of the line:


This tells it to match a group, that consists of "everything that is not a : character"


The literal : is matched by itself

And in the end, this matches "everything until the end of the line"


(the $ matches the "end of the line")

And the replacement means "put in the first group matched, followed by a :, and then the secound group matched".

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.