これを試して:
string str = "Addadafafa/DHello/p2324141142DsddDsdsds/Dgood/p23323";
Regex reg = new Regex(@"/D(\w+)/p");
MatchCollection matches = reg.Matches(str);
string result = "";
foreach (Match match in matches)
{
result += match.Result("$1") + " ";
}
Console.WriteLine(result);
または:
string str = "Addadafafa/DHello/p2324141142DsddDsdsds/Dgood/p23323";
Regex reg = new Regex(@"(?!/D)[^D]\w+(?=/p)");
MatchCollection matches = reg.Matches(str);
string result = "";
foreach (Match match in matches)
{
result += match.Value + " ";
}
Console.WriteLine(result);