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);
My regex command are fault(i know)but i want capture meta:resourcekey = "......" from my messagebox text i want only .... part of my capturing.
Here is plain regex
meta:resourcekey[\s]=[\s]\"(.*?)\"
And here is c# Example
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);
}