这似乎应该是微不足道的,但我对正则表达式并不是很好,这对谷歌来说似乎并不容易.
我需要一个以字符串'dbo'开头的正则表达式.并以字符串'_fn'结尾
就我而言,我不关心这两个字符串之间的字符是什么,只要开头和结尾都是正确的.
这是为了匹配SQL Server数据库中的函数.
例如:
dbo.functionName_fn - Match
dbo._fn_functionName - No Match
dbo.functionName_fn_blah - No Match
Run Code Online (Sandbox Code Playgroud) 在Vim中,有没有办法搜索匹配的行abc但是xyz后面还不包含该行?所以以下几行将匹配:
The abc is the best
The first three letters are abc
Run Code Online (Sandbox Code Playgroud)
并且以下内容不匹配:
The abc is the best but xyz is cheaper
The first three letters are abc and the last are xyz
Run Code Online (Sandbox Code Playgroud)
我知道如下语法:
/abc\(xyz\)\@!
Run Code Online (Sandbox Code Playgroud)
但这只是避免匹配,abcxyz而不是中间是否有任何东西,例如abc-xyz.运用
/abc.*\(xyz\)\@!
Run Code Online (Sandbox Code Playgroud)
也不起作用,因为后面的线路中有许多位置xyz不匹配.
(我应该注意,在命令行上我会做类似的事情,grep abc <infile | grep -v xyz但我想在Vim中以交互方式进行上述操作.)