safari "find" does not work for partial word [duplicate]

Sorry but I don't know how to describe this problem. Let's see a simple example below.

Take this page as an example, when I search(cmd+F) "comp", safari is able to find everything about it; but if I search "omp", nothing can be found! (suppose I want to find strings containing "complete")

This can be inconvenient sometimes because I may forget the spelling of the first several letters of a word/string, or I may be only concerned about the postfix, namely, finding all strings with a given postfix(or 'midfix') and the prefix can be arbitrary.

Can someone explain this issue and is there a way to resolve it ?


This is by design. Clicking on the magnifying glass next to your search shows a menu that allows you to switch between Contains and Starts With, with the latter being the default.

There is a hidden setting to change the default to Contains.

  1. Quit Safari. (Safari menu > Quit or Command-Q)
  2. Open Terminal. (Applications > Utilities > Terminal)
  3. Copy/paste the following line exactly and press Return:

    defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool FALSE
    

The next time you run Safari, substring matching (which is what you are trying to do) should work correctly.