Vim 正视匹配模式
Vim positive look behind match pattern
代码如下:
return (
<div></div>
)
注意<div></div>
上面有一个空行。
我想在 <div>
中匹配 <
。这是我尝试过的:
- 模式
\((\_s*\)\@<=<
无效,但 \((\_s*\)\zs<
有效。
- 模式
\((\_s*\)\@<=<
只有在我删除 `. 上方的空行时才有效
所以,我的问题是:
\@<=
和\zs
有什么区别?
- 如何用
\@<=
匹配<
而不去掉上面的空行? (这个对我比较重要)
What's the difference between \@<=
and \zs
?
- lookbehind 运算符
\@<=
不能搜索早于上一行
\zs
和 \ze
允许您显式定义匹配
参见 :help \@<=
和 :help \zs
How to use \@<=
to match the <
without remove the blank line above?
你不能。出于性能原因,lookbehind 不会在匹配前查看 2 行
代码如下:
return (
<div></div>
)
注意<div></div>
上面有一个空行。
我想在 <div>
中匹配 <
。这是我尝试过的:
- 模式
\((\_s*\)\@<=<
无效,但\((\_s*\)\zs<
有效。 - 模式
\((\_s*\)\@<=<
只有在我删除 `. 上方的空行时才有效
所以,我的问题是:
\@<=
和\zs
有什么区别?- 如何用
\@<=
匹配<
而不去掉上面的空行? (这个对我比较重要)
What's the difference between
\@<=
and\zs
?
- lookbehind 运算符
\@<=
不能搜索早于上一行 \zs
和\ze
允许您显式定义匹配
参见 :help \@<=
和 :help \zs
How to use
\@<=
to match the<
without remove the blank line above?
你不能。出于性能原因,lookbehind 不会在匹配前查看 2 行