0

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.

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
0

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!

  • 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
1

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.