Daniel Que
Daniel Que

Reputation: 1734

Finding text, excluding supersets in Sublime

I remember hearing about the option to search for an exact word in Sublime, but I can't seem to find it.

What I mean by this is if I search for write, I'd like to exclude all instances of foo_write, foowrite, etc.

How can this be done?

Upvotes: 5

Views: 3136

Answers (2)

MikeA
MikeA

Reputation: 219

Also, the third button from the left, a pair of double quotes, says 'Whole Word' when you hover - Click this to find the exact word.

E.g., if I search for 'stage' it will return the line that contains the text 'when the stage changes' but not the line that contains the text '= b.stage__c'

Upvotes: 0

MattDMo
MattDMo

Reputation: 102902

Hit CtrlF (Win/Lin) or CmdF (OS X) to open up the Find tab. Make sure the first button on the left (Regular Expressions) is selected. In the search field, enter \bfoo\b and click the Find button or hit CtrlG/CmdG to search. The \b token indicates a word boundary, including spaces, punctuation marks like commas, periods/full stops, question marks, etc.

Upvotes: 8

Related Questions