使用此代碼:regex = new Regex(@"^(?:\S+\s){2}(\S+)");match = regex.Match("one two three four five");if (match.Success){ Console.WriteLine(match.Value);}我想檢索該行的第三個單詞 --> “three”。但相反,我得到了“一二三”。編輯:我知道我可以用它來做,s.Split(' ')[2]但我想用正則表達式來做。
獲取一行的第 n 個單詞
慕婉清6462132
2021-11-28 20:07:16