Advanced searching in Vim

二次信任 提交于 2019-12-03 13:13:36
/^joe.*fred.*bill/          : find joe AND fred AND Bill (Joe at start of line)
/fred\|joe                  : Search for FRED OR JOE

Actually I found the answer soon after I posted this (yes I did google earlier but was unable to locate it. Probably was just searching wrong)

The right solution is

/(foo\|bar)

@Paul Betts: The pipe has to be escaped

Vim supports regular expressions by starting in command mode with a '/'.

So using something like "/(foo\|bar)" (as was stated before) would solve the problem. It's good to know why that works and what you are using (regular expressions).

/(foo|bar)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!