tags:

views:

54

answers:

3

Please tell me how to search for a specifig word if the file is opened in VI Editor. I know we can do it by using /word_to_be_search but it will not do the exact search for the word.

Example
/sachin will searches for sachin_server, sachin_client and not only sachin
+7  A: 

Try instead:

/\<word\>

the \< and \> match word boundaries.

Nick Dixon
Thanks I got the answer
Sachin Chourasiya
...and in Vim, you can ":set iskeyword" to define the characters considered part of a "word"
Nick Dixon
+3  A: 
/\<sachin\>

\< is the beginning of word, and \> is the end of word marker.

Paul Tomblin
A: 

do this:

/\

brianh
It wont work as it will only search for words starting with the pattern to be searched
Sachin Chourasiya