我需要在Buyers.Buyers['id:i8yo3o5tj'].BuyingRoles.value['id:1'].checked
字符串中用;
char替换所有索引。我尝试通过正则表达式来做到这一点:
var _indexRule = @"\['id:(.{1,50})'\]\.";
Regex rgx = new Regex(_indexRule);
var replacer = ";";
var key = "Buyers.Buyers['id:i8yo3o5tj'].BuyingRoles.value['id:1'].checked";
var newKey = rgx.Replace(key, replacer);
我期望得到Buyers.Buyers;BuyingRoles.value;checked
字符串,但得到Buyers.Buyers;checked
。
为什么会发生,我该如何解决?