Vim supports the use of regular expressions when searching through a file.
The character to indicate that you wish to perform a search is
The simplest search you can perform is the following
This will search the entire file for all instances of
if. However, our search
if is actually a regular expression that will match any occurrence of the word
if including those inside of other words.
For instance, our search would say all of the following words match our search:
We can do more complicated searches by using more complicated regular expressions.
If our search was:
then our search would only return exact matches to the full word
if. The above
endif would not be returned by the search, only
We can also use ranges. Given a file:
hello1 hello2 hello3 hello4
If we want to search for those lines containing "hello" followed by a digit between 1 and 3 we would say:
would find all of the integer and decimals numbers in the file.