Monday, April 1, 2019

vi editor: match multiple strings


In vi or vim, we use / to search for a string. If we want the searching matches either string1 or string2, we can do:
/string1\|string2

If we also want to search for more strings at the same time, we certainly can:
/string1\|string2\|string3\|string4

If we want to ignore cases during the search, we can set the ignorecase option before the search.
:set ic

To remove the ignorecase option:
:set noic

No comments:

 
Get This <