-2
如何將我的var userId設置爲正則表達式?正則表達式將一個var放入另一個正則表達式的值
string userId = "ololoawd";
string did = Regex.Match(content, @"""dID"":""(.*?)"",""dOF"":true,""dOID"":"" + userId + "",""usS"":").Groups[1].Value;
如何將我的var userId設置爲正則表達式?正則表達式將一個var放入另一個正則表達式的值
string userId = "ololoawd";
string did = Regex.Match(content, @"""dID"":""(.*?)"",""dOF"":true,""dOID"":"" + userId + "",""usS"":").Groups[1].Value;
沒有指定正是您期望作爲輸出。我只能看到,在連接userId之前沒有正確終止第一個字符串。請嘗試以下操作:嘗試以下操作:
string userId = "ololoawd";
string did = Regex.Match(content, @"""dID"":""(.*?)"",""dOF"":true,""dOID"":""" + userId + @""",""usS"":").Groups[1].Value;
string did = Regex.Match(content, @"""dID"":""(.*?)"",""dOF"":true,""dOID"":" + userId + ",""usS"":").Groups[1].Value;