Find previous doesn't work
-
I have a strange issue where “Find Previous” doesn’t work. Nothing happens when pressing the keyboard shortcut F4 or using the menu (Search > Find Previous). “Find Next” works just fine. Any ideas how to fix this?
-
If you are in Search Mode = Regular Expression, then find-previous does not work … by default. This is because regex don’t work as you expect them to in reverse direction.
If you would like to enable regular expression reverse search, you will have to edit a configuration file manually, as described at npp-user-manual.org
If this does not match your problem, you will have to describe things more fully (a screenshot of your Find dialog would go a long way toward that).
-
@PeterJones thanks, Search Mode = Regular Expression was the issue. Do you have an example of a regex that doesn’t behave as expected when searching in reverse? I have done it many times in other editors such as Vim and Sublime Text without encountering any issues.
-
@Steven123 said in Find previous doesn't work:
Do you have an example of a regex that doesn’t behave as expected when searching in reverse?
I did some research and it appears the logic for disabling the feature was that certain regex do not produce the same matches when moving forward through a series of different matches as is produced when moving backward through the same text.
It was deemed desirable from a user perspective to produce the same hits moving in either direction (otherwise users would put in bugs about this).
The example cited was this one:
find:
t\w+
on this text:
to the test they travelled
which, if you try an older version of Notepad++ where backward searches were allowed, it does indeed produces different results.