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

Here is my regex statement which works great and highlights what I'm looking for in notepad++

(?<=thd)(.*)(?=]]><\/g_n>)

But when I try to replace it with nothing aka an empty line or a space nothing happens and it just skips to the next find.

I even tried replacing what it found with like '123' or something and that doesn't work either.

To make sure notepad++ is working properly I just did some simple regex replaces and those worked fine.

share|improve this question

migrated from stackoverflow.com Jun 2 '13 at 20:10

This question came from our site for professional and enthusiast programmers.

    
Are you sure? Try selecting everything in the text and check In selection then do the Replace All. – Jerry Jun 2 '13 at 15:48
    
That fixed it. Why did I need to highlight everything and choose "in selection"? is there something unique about the regex? – Neil Jun 2 '13 at 15:53
    
I put that in an answer. – Jerry Jun 2 '13 at 15:55
up vote 0 down vote accepted

Are you sure? Try selecting everything in the text and check In selection then do the 'Replace All'.

I suspect that your cursor was at the end of the file when you clicked 'Replace All' and the option was "Direction: Down". I do that myself sometimes without realising it only later!

share|improve this answer
    
you wouldn't happen to know how I can replace and remove the whitespace from \s[0-9]+ thd once it's found? – Neil Jun 2 '13 at 16:00
    
@Neil I left a comment in your new question. I'm not sure I understand your question since [0-9]+ means a number and I would have thought you used {0-9}+. – Jerry Jun 2 '13 at 16:22

You mean simply remove the space preceeding the number(s) (typo "thd"?) ?

Ctrl-H , then search for \s([0-9]+) , replace with \1 . make sure the mode "Regular expressions" are activated.

share|improve this answer

Your Answer

 
discard

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