Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Edit: While I refer to RegEx in my background, I'm not looking for you to fix my RegExp (thanks for trying though) - rather I want to know "how do I abort a search/replace in NotePad++".


Environment

I'm using latest version of NPP (v.5.9.6.2) on Windows 7 64 bit

Background (aka "The Problem")

Occasionally I use NPP to manipulate bits of text and more often than not I use regular expressions during that process. While it is no criticism of the product (how can it be?), Notepad++ allows me to do stupid things that don't behave as I intended. Case in point, I had a long list of values which I wanted to enclose in quote marks. I entered an accidentally aggressive expression and it caused an infinite loop.

The reason for the loop is immaterial and is not the point of my question - I've made this mistake more than once - i know it doesn't work, but I forget and months later will do the same thing again.

The problem is that when NotePad++ goes into this infinite loop, trying to complete the imposisble, I am effectively locked out of all of my unsaved documents and forced to kill the NPP process.

Question

I can't find anything documented in Help or in the NPP "forum" but does anyone know of a way for me to abort a search and replace, such as in the aforementioned scenario, thereby allowing me to back out of my mistake and more importantly, save all of my other documents?

share|improve this question

migrated from stackoverflow.com Aug 17 '12 at 8:25

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

    
Did you try to replace \$ with ' ? –  Ωmega Aug 16 '12 at 11:17
    
Thanks for your reply and sorry if it's not entirely clear from my question, $ was intended to match the end of the line and place a quote mark there (rather than, as you imply, looking for an explicit dollar sign and replacing that with quote). In any case though, it is the ability to abort the search that I am looking for really :) –  Greg Aug 16 '12 at 11:30
1  
Well, there is always end of string/file ahead, as you cannot go beyond that, so that might be an issue why you experience an infinite loop. I don't have NPP installed, but... how about replace \b(?=$) with ' ? –  Ωmega Aug 16 '12 at 11:50
    
In many RegEx flavors replacing /^(.*?)$/ with "'$1'" works. Have you tried that? –  inhan Aug 16 '12 at 11:55
    
I usually just do \r\n instead of $ and its working fine. –  Burnzy Aug 16 '12 at 11:56

1 Answer 1

Just by pure chance today I stumbled about the AnalysePlugin in NPP's Plugin Manager window and it says in its Latest update comments:

feature: please wait popup to allow user to cancel long lasting searches and a progress bar

This is not exactly what you are asking for (search AND replace), but it may be helpful for pure (long running) search.

share|improve this answer
    
Pending a test I'll mark this up answer. Great find @splash. –  Greg Aug 21 '12 at 9:04
    
Actually, you're right it's not quite what I'm after (I got a bit too excited that it was just then!) but it is useful nonetheless. Also I've never really explored NPP plugins so you've just opened a whole new world of "wow look at that" for me ;) –  Greg Aug 21 '12 at 9:10

Your Answer

 
discard

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.