Search code examples
sublimetext3

Searching exact woed in sublime text not working


I'm using Sublime Text and I want to search .btn in a CSS stylesheet, but I get unexpected results like .btn-sm too. I have turned on whole word but it seems not working properly...

How can Ido this?


Solution

  • A regex search will do the trick:

    \.btn(?![-|\w])
    

    It searches for the literal sequence .btn with a negative lookahead to make sure the next character is not either a - symbol or a word character. This way the search won't match .btnfoo, for example (line 6 below).

    example