在VIM语法文件中,如何在结束匹配中使用开始匹配?

在VIM语法文件中,如何在结束匹配中使用开始匹配?,vim,syntax,xquery,Vim,Syntax,Xquery,在VIM语法文件中,可以编写如下语法区域匹配: syn region xqString start=+'+ end=+'+ syn region xqString start=+"+ end=+"+ 我想写的是 syn region xqString start=+(['"])+ end=+\1+ 其中\1是在开始中找到的匹配项。有关于如何执行此操作或无法执行此操作的答案吗?请参阅:帮助:syn ext match 外部匹配:syn-ext-match 这些额外的正则表达式项在区域模式中可用

在VIM语法文件中,可以编写如下语法区域匹配:

syn region xqString start=+'+ end=+'+
syn region xqString start=+"+ end=+"+
我想写的是

syn region xqString start=+(['"])+ end=+\1+

其中\1是在开始中找到的匹配项。有关于如何执行此操作或无法执行此操作的答案吗?

请参阅
:帮助:syn ext match

外部匹配:syn-ext-match

这些额外的正则表达式项在区域模式中可用:

        */\z(* */\z(\)* *E50* *E52*
\z(\) Marks the sub-expression as "external", meaning that it is can
be accessed from another pattern match.  Currently only usable
in defining a syntax region start pattern.

      */\z1* */\z2* */\z3* */\z4* */\z5*
\z1  ...  \z9     */\z6* */\z7* */\z8* */\z9* *E66* *E67*
Matches the same string that was matched by the corresponding
sub-expression in a previous start pattern match.

所以你可以做
syn region xqString start=+\z(['''']\)+skip=+\.+end=+\z1+

我的最后一行看起来像
syn region xqString start=+\z(['']\)+skip=+\.+end=+\z1+