匹配两个引号对中的任何字符,包括嵌套引号

Match any char inside two quotation pairs, including nested quotations

我有数据会像这样在每行中显示为双引号对。

"Key" "Value"

这些对里面可以有任何字符,有时会出现 可怕的“”嵌套对:

"Key "superkey"" ""Space" Value"

之前我发现:"([^"]*)"\s*"([^"]*)" 这将键和值匹配到两组:

 = Key
 = Value

但是,对于嵌套对,它只会输出:

 = superkey

有没有办法匹配对之间的所有字符?需要示例输出:

 = Key "superkey"
 = "Space" Value

QRegularExpression 和 c++11 文字字符串的正则表达式处理:

QRegularExpression(R"D("([^"]*)"\s*"([^"]*)")D");

我知道它匹配 Pearl 和 PHP 正则表达式。

"(.*?)"[\t\r ]+"(.*?)"(?=[ ]*$)

尝试 this.See 演示。

https://regex101.com/r/hR7tH4/2