Search for substrings in Safari

Blogger Pierre Igot was frustrated with the search behavior in Lion's Safari. Back in Snow Leopard's version of Safari, if you hit Command-F (or selected Edit -> Find) and then entered a string of text, the program would find any instance of that text in the current webpage: It would match the search string whether it was a whole word or just part of one. But in Lion's Safari, search didn't work the same way: It matched strings that were whole words or that appeared at the beginnings of words, but didn't find them within words. So, for example, searching this page for man in Snow Leopard would find my last name in the byline above; in Lion, by default, it doesn't.

Some of Pierre's readers offered him the solution. As it turns out, Safari in Lion offers finer-grained controls for setting the search scope. Once you've hit Command-F to initiate a search, you can click on the magnifying glass within the search box to expose a small menu. From that menu, you can choose between Contains and Starts With.

Starts With, the default, only matches substrings when (as you'd guess) they start words; that is, it would find my last name if you searched for fried instead of man. The Contains option does what the name implies: As in Snow Leopard, it finds substrings regardless of where they occur in the word.

You can make Contains the default search option by opening Terminal and entering:

defaults write FindOnPageMatchesWordStartsOnly -bool FALSE

(That last bit was posted by blogger Joel Brunerd.)

One more Safari tip while we're at it: Lion's full-screen mode can sometimes cause webpages to look stretched out: Many sites aren't designed to expand to fill to the full width of your monitor. But an anonymous Hints reader discovered that you can resize webpages' widths while in full-screen mode.

To do so, move your mouse all the way to the left or right edge of the page. (This can be tricky if you have a second monitor; you need to make sure that you get the cursor to the edge of the full-screen page, without letting the cursor jump to your adjacent screen.) Once the cursor changes from the traditional arrow to a horizontal resizing pointer, click and drag to shrink the page's width.

When you resize webpages this way, the new width is set only for the current tab in the current window—every other tab and window will retain its current width.

To comment on this article and other Macworld content, visit our Facebook page or our Twitter feed.
Shop Tech Products at Amazon