DTE dte = Package.GetGlobalService(typeof(DTE)) 作为 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 = "......" 我只想要 .... 我捕获的一部分。