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

I know this can be done in notepad++, but I'm not finding the right replace syntax.

I want to remove the last part of this sentence, starting from ?:

so that it becomes:
share|improve this question

The regexp is \?.*$

\? mean question mark itself
.* mean everything else
$ means the end of line.

So we search something starting with question mark and lasts to the end of line. Don't forget to set "search mode" to "regular expression"

enter image description here

share|improve this answer
thanks a lot man that helped and what about lines with out ? example… replace to – king Feb 18 '12 at 12:49

Using those examples, it would be better to use something like:


Then replace with:


That should find everything after (and including) index.php, and replace it with just index.php.
share|improve this answer
thank you so much, putnik, alex and josh you guys solved it – king Feb 18 '12 at 14:49

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.