is c# regex pcre code example
Example: c# regex
public static Dictionary<string, string> FindPattern(this string text, string pattern)
{
Regex expression = new Regex(pattern);
Match match = expression.Match(text);
Dictionary<string, string> matchvalue = new Dictionary<string, string>();
if (match.Success)
{
foreach (string g in expression.GetGroupNames())
{
matchvalue[g] = match.Groups[g].Value;
}
return matchvalue;
}
else
{
foreach (string g in expression.GetGroupNames())
{
matchvalue[g] = "";
}
}
return matchvalue;
}