find bug for exact match

  • Hi,

    I think this is a bug with notepad++ 7.4.2.
    To reproduce the bug try this,

    1. copy, paste the following four lines into notpad++


    2. 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?

  • 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:
    [1] Search for search string regardless of words. On match test if whole word.
    [2] Traverse text “word by word” and compare each word against search string.

    Option [1] 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.

  • 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.

  • @ramromail , @gstavi :

    There is a great discussion (from @guy038) of this behavior here:

    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 ^ in the ^ 0 v area on the right ).

  • [1] 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.

    [2] 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?


Log in to reply