Sublime Forum

"Whole Word" searches could be a bit smarter... [ST3]

#1

Try making a new blank document with the following text:

Hello World

If you enter the following in the search box:

Hello World
Then Sublime Text will find it with no problems.

However if you enable the “whole word” option then Sublime Text, then the search will fail to find any results.

I understand why this is happening. Looking at the error in the status message, it seems that if you enable the “whole word” option, Sublime Text just lazily slaps "\b"s around your search-text.

Could it be a little more intelligent, and only add a “\b” to the start and the end of your search text if the search text does actually start or end in a word-character respectively? Basically, “whole word only” should mean “if there search term starts or ends with a word, the whole word needs to match” - and not “only match search terms that start and end with a word”. This is how most other editors work.

0 Likes