我最近遇到了Vim regex builtins中的分支說明符。在\&
Vim的幫助部分包含此:什麼是Vim的正則表達式中的模式
A branch is one or more concats, separated by "\&". It matches the last
concat, but only if all the preceding concats also match at the same
position. Examples:
"foobeep\&..." matches "foo" in "foobeep".
".*Peter\&.*Bob" matches in a line containing both "Peter" and "Bob"
目前尚不清楚它是如何使用,並且用途。對它做什麼以及如何使用它的一個很好的解釋會很好。
需要明確的是,這是不的&
(與全匹配替換)在取代所使用的,這是在一個圖案中使用的\&
。
實例:
/\c\v([^aeiou]&\a){4}
用於搜索連續4個輔音(從VIM提示兩者)。
如果可以鏈接到您已經閱讀過的wiki或手冊頁,那將會很棒嗎? –
@Sniffer':幫助模式'。 – mhinz
@mhinz我在這個時候運行Windows,我沒有VIM,但無論如何,你似乎知道答案,所以它很好。謝謝。 –