我想用空格替换引号中包含的所有分号。我怎样才能在C#
?
例如:
这个字符串:
this is an example; "this is other ; example"
会回来:
this is an example; "this is other example"
我等待你的帮助!
答案 0 :(得分:4)
试试这个:
string input = "this is an example; \"this is other ; example\"";
var regex = new Regex("\\\"(.*?)\\\"");
var output = regex.Replace(input, m => m.Value.Replace(";"," "));
答案 1 :(得分:0)
编辑:这将有效。
string yourString = "hello there; \"this should ; be replaced \"";
string fixedString = Regex.Replace(yourString, "(\"[^\",]+);([^\"]+\")", delegate (Match match)
{
string v = match.ToString();
return v.Replace(";", " ");
});
答案 2 :(得分:-2)
请尝试以下操作:
"images": [
{
"key": "value"
},
{
"key": "value"
}
]