Re: find a whole word
how can I write a regexp for searching a whole word? similar to what the check box in the "Find Dialog" does.
You are not logged in. Please login or register.
how can I write a regexp for searching a whole word? similar to what the check box in the "Find Dialog" does.
from the docs:
Word beginning/end
In the same way that '^' and '$' provide a way to "anchor" the pattern to the beginning or end of a line, the tokens "\<" and "\>" provide a way to anchor a pattern to the beginning or end of a word. The beginning of a word is defined as a word character ([_a-zA-Z0-9]) following a non-word character (or at beginning of line). The end of a word is defined as a non-word character or end of line, after a word character. These are zero-width matches.
so /\<foo\> finds foo but not foobar
And if you use the '*' or '#' motions (direct commands in normal- or visual-mode), it automatically searches for the word under the cursor with \< and \> put around it (whole word).
And as an extra goodie, 'g*' and 'g#' search for the word under the cursor without the whole-word limitation.
I use '*' and '#' all the time, it's a huge time-saver.
Did you ever look into making * and Ctrl-F3 (visual studio's find current word) the same? I still get hit by going back and forth between using vi stuff and VS stuff intermixed. This would be a nice one, that way I wouldn't have to remember how I searched for what it is I'm looking for.
I have some requests in the backburner to integrate ViEmu's and VS's search somehow. I have investigated this area with Codekana, and it's not really very accessible (duh). I'll take not of your request for some future research.
Thanks a lot.
Currently installed 3 official extensions. Copyright © 2003–2009 PunBB.
[ Generated in 0.030 seconds, 7 queries executed ]