[英]How to search for a pattern in Vim
I am trying to search for all the strings following a pattern in a file that I have opened with gvim.我试图在我用 gvim 打开的文件中搜索遵循某个模式的所有字符串。
The pattern that I want to match is-我要匹配的模式是-
T0: {any_string1}_{anystring2}_{anystring3}:
where there can be any no of such "anystrings" in the pattern(which means there can be such 4 strings in the same pattern or may be 5 strings which is not fixed) and also those strings can be anything.模式中可以没有任何这样的“任何字符串”(这意味着相同模式中可以有这样的 4 个字符串,或者可能是 5 个不固定的字符串),而且这些字符串可以是任何东西。 Can somebody please tell me how to search for lines satisfying the above string pattern in gvim有人可以告诉我如何在 gvim 中搜索满足上述字符串模式的行
按esc键并输入/ 。然后执行以下操作:
T0: \({\S\+\}_\?\)/+\:
You can construct the search-pattern with these items:您可以使用以下项目构建搜索模式:
.
: any single character : 任何单个字符*
: 0 or more matches of the preceding *
: 0 个或多个前面的匹配项.*
: your "anystring" which can be anything , including nothing .*
: 你的“anystring”可以是任何东西,包括什么都没有\\(…\\)
: grouping \\(…\\)
: 分组So, your pattern with any no (I assume at least one) of such "anystrings" is matched by所以,你的模式没有(我假设至少有一个)这样的“anystrings”匹配
T0: {.*}\(_{.*}\)*:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.