尝试使用此正则表达式:
"[^"rn]*"|'[^'rn]*'|[^,rn]*
Regex regexObj = new Regex(@"""[^""rn]*""|'[^'rn]*'|[^,rn]*"); Match matchResults = regexObj.Match(input); while (matchResults.Success) { Console.WriteLine(matchResults.Value); matchResults = matchResults.NextMatch(); }:
- 猫
- 狗
- “ 0 = OFF,1 = ON”
- 狮子
- 虎
- ‘R =红色,G =绿色,B =蓝色’
- 熊
注意:
此正则表达式解决方案适用于您的情况,但是我建议您使用专用的库,例如FileHelpers。



