[TxMt] find with "match entire word"

Ian Smith-Dahl isd at strangetower.com
Wed Jul 18 17:11:53 UTC 2007


I'm not totally following you, but it sounds like you want to search  
over the pattern boundaries without matching them.    If so, then you  
want to look at the look-ahead, (?=foo), and look-behind (?<=foo)  
expressions.

HTH,
-- Ian

On Jul 18, 2007, at 12:34 PM, Craig Schmidt wrote:

> 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
>
>
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate




More information about the textmate mailing list