测试字符串:
best.string_a = true;
best.string_b + bad.string_c;
best.string_d ();
best.string_e );
我希望在'之后捕获字符串。'除了'('。我的表达:
\.\@<=[_a-z]\+\(\s*[^(]\)\@=
我想:
string_a
string_b
string_c
string_e
但它没有工作和结果:
string_a
string_b
string_c
string_d
string_e
我是vim正则表达式的新手,我不知道为什么:(
答案 0 :(得分:2)
制作此\.\@<=\<[_a-z]\+\>\(\s*(\)\@!
匹配:
\.\@<= Assure a dot is in front of the match followed by
\<[_a-z]\+\> A word containing only lowercase or '_' chars
\(\s*(\)\@! not followed by (any amount of spaces in front of a '(')
答案 1 :(得分:1)
这也可以满足您的需求:
\.\zs[_a-z]\+\>\ze\s*[^( ]