find bug for exact match
ramromail last edited by
I think this is a bug with notepad++ 7.4.2.
To reproduce the bug try this,
copy, paste the following four lines into notpad++
try to search/find (normal not regex) for $abc, with “Match whole words only option checked” and you will see the match on 3rd line will not be found by notepad++
Is this a bug or am I missing something here?
gstavi last edited by
The definition of “whole word” is fuzzy so it is hard to decide if this is a BUG.
Specifically the definition of whole word is problematic when the search string by itself contains “special” symbols.
What symbols are word delimiters?
Once you added ‘$’ symbol into the search string who can decide if ‘(’ symbol is not a continuation of the same word?
Which of the following should ‘find $abc’ stop upon?
Nevertheless, I do agree that likely most users would always consider parentheses symbols as “word breakers”.
I wonder which of the options (if any) the find algorithm uses with “whole word” enabled:
 Search for search string regardless of words. On match test if whole word.
 Traverse text “word by word” and compare each word against search string.
Option  allows more flexibility in definition of ‘word’. It is easier for it to use search string by itself as criteria for which delimiters are relevant.
ramromail last edited by
I believe as text editor for coding purposes, (for e.g. incase of C, C++, PHP etc) $ symbol should not be treated as special symbol but as any other character, similarly in other programming language.
Scott Sumner last edited by
There is a great discussion (from @guy038) of this behavior here: https://notepad-plus-plus.org/community/topic/13004/bugs-in-normal-search-for-v7-2-2-on-windows-7/4
My takeaway from that thread is that if you are going to check the Match whole words only checkbox, you should expect “good” behavior from the search only if your first and last characters in the Find what box are “word” characters in the set: A-Z, a-z, 0-9, and _
If this (or ANY posting on the Notepad++ Community site) is useful, don’t reply with a “thanks”, simply up-vote ( click the
^ 0 varea on the right ).
Marcelo Finkielsztein last edited by
 Suggested Workaround approach for ramromail:
Do not use “whole words” options for coding scenarios.
It seems that the “whole word” definition is too simplistic for your needs. Use regex instead, where you will be able to define separators to you convenience.
 Suggestions for npp coders (Wish list):
[2.1] When the user picks “whole word”, show “advanced options” for the user to define their own word delimiters.
[2.2] Or add a config section for word delimiters among the preferences?