daemianmack - 2008-12-16

Capture groups don't seem to be behaving as expected in Find/Replace operations.

To reproduce...

1 - Start with this existing text in Notepad++...

**
29th of December
30th of December
31st of December
1st of January
2nd of January

**

2 - Let's assume you need the text reformatted like so...

**
December 29th
December 30th
December 31st
January 1st
January 2nd
**

3 - Hit Ctrl+R to invoke the Find/Replace dialog.

4 - In the top textarea, type...

([0-9]+..) of ([a-z]+)

5 - In the bottom textarea, type...

\2 \1

6 - Ensure 'Regular Expr' is selected.

7. Click 'Find'. The first matching row of text is selected.

8. Click 'Repl&FAgain' to replace that row with your text and repeat the Find operation from step 7.

9. Click 'Repl&FAgain' to repeat step 8. Note that the text has been replaced with an empty line -- not your replacement text.

Further invocations of 'Repl&FAgain' produce rows of empty text.

The issue seems to center around the 'Repl&FAgain' routine itself...

- Starting the sequence with the 'Find' button and then using 'Replace Rest' doesn't exhibit the behavior.
- Starting the sequence with the 'Find' button, and then using 'Repl&FAgain' will produce the empty rows of text until you click 'Replace Rest', which will replace the rest of the matches as expected.