How to abort a long-running regex replace

infinite loopnotepadregex

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?

Best Answer

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.

Related Question