Vim submatch() 函数

使用说明

submatch() 函数返回的是子表达式中的内容。
submatch(0) 返回整个匹配的字串。
submatch(1) 返回第一个匹配的字串。
submatch(2) 返回第二个匹配的字串。
注意:子表达式表示的是{pattern}中的括号内的表达式,一个双括号算一个表达式,两个双括号算两个表达式。
没有双括号即没有子表达式则不能使用submatch(1)

参考

https://www.runoob.com/regexp/regexp-syntax.html
https://yianwillis.github.io/vimcdoc/doc/pattern.html#pattern.txt
https://yianwillis.github.io/vimcdoc/doc/usr_41.html

posted @ 2022-07-27 17:19  3yude  阅读(214)  评论(0)    收藏  举报