我想使用正则表达式提取引号内的数据
My Text is : boundary="s323sd2342423---"
现在我需要在不使用子字符串的情况下提取双引号内的值。
我尝试了以下但没有帮助。
String pattern = @"boundary=""(?<value>[^""]*";
Match m = Regex.Match(rawMessage, pattern);
while (m.Success)
{
boundaryString = m.Groups["value"].Value;
m = m.NextMatch();
}
请您参考如下方法:
你需要关闭组的左括号
String pattern = @"boundary=""(?<value>[^""]*)";
现在如果你去
Console.WriteLine(m.Groups["value"].Value);
将打印:
s323sd2342423---
