[TxMt] find with "match entire word"

Craig Schmidt craig at craigschmidt.com
Wed Jul 18 16:34:04 UTC 2007


Hi There,

This seems like a FAQ, but I haven't been able to find the answer  
after some looking. Textmate doesn't have a "match entire word" check  
box in the find dialog, like most text editors.  Presumably, we're  
supposed to use regular expressions to achieve the same effect.  Most  
times, the word is a variable name.  So for my variable x in C++, I  
want to find all uses including:

x[i]
x->foo
x.bar

I've been trying to bracket the variable with the "non word  
character", so I search for the regular expression \Wx\W

This excludes xbar, and foox. However, this isn't quite the same as  
matching just the word, as the find dialog also selects the previous  
and next character, matching the \W. I can't use it in a replace, for  
example.  Is there some cleaner way of doing this?

Thanks,
Craig Schmidt






More information about the textmate mailing list