C# 自定义包中的正则表达式我想捕获 (meta:resourcekey ="......")

Regex in Custom package in C# i want capture (meta:resourcekey =".......")

DTE dte = Package.GetGlobalService(typeof(DTE)) as DTE; TextDocument activeDoc = dte.ActiveDocument.Object() as TextDocument;

        var text = activeDoc.CreateEditPoint(activeDoc.StartPoint).GetText(activeDoc.EndPoint);


        var input = (text);

        var regex = new Regex(@"(\bresourcekey\b+) = ");

        var match = regex.Matches(input);

        string matches = string.Empty;

        foreach(var item in match)
        {
            matches += item.ToString() + " "; 
        }

        MessageBox.Show(matches);

我的正则表达式命令有问题(我知道)但我想从我的消息框文本中捕获 meta:resourcekey = "......" 我只想要 .... 我捕获的一部分。

这是普通的正则表达式

meta:resourcekey[\s]=[\s]\"(.*?)\"

这是 c# 示例

var mydata = "meta:resourcekey = \"something\"";
Regex regex = new Regex("meta:resourcekey[\s]*=[\s]*\"(.*?)\\"");
foreach (Match htmlPath in regex.Matches(mydata))
{
    Console.WriteLine(htmlPath.Groups[1].Value);
}
DTE dte = Package.GetGlobalService(typeof(DTE)) as DTE;
        TextDocument activeDoc = dte.ActiveDocument.Object() as TextDocument;

        var text = activeDoc.CreateEditPoint(activeDoc.StartPoint).GetText(activeDoc.EndPoint);


        var input = (text);

        Regex regex = new Regex(@"(meta:resourcekey)+(\W)+(\w*)+(\W)");

        var match = regex.Matches(input);

        string matches = string.Empty;

        foreach(var item in match)
        {
            matches += item.ToString() + " "; 
        }

        MessageBox.Show(matches);

我找到了类似 that.That 的答案,使 Scann 成为当前页面代码并写入文本,最终获得 meta:resourcekey="something" 所有代码页...写入 MessageBox