我無法弄清楚如何從字符串中提取特定的匹配數字。正則表達式幫助從字符串中提取值
實施例:
string myString = "blah blah **[10]** blah **[20]** and some more blah **[30]**";
Regex myIDsReg = new Regex(@"\*\*\[(\d+)\]\*\*");
顯然,正則表達式是聲音。
Match myMatch = myIDsReg.Match(myString);
產生「** [10] **」但沒有別的。
我無法弄清楚如何得到一個數組具有以下值:10,20,30
請不要用「C#」等來標題。這就是標籤的用途。 –