查找二维数组中的所有字符串,如模板

时间:2014-11-26 06:19:53

标签: c# linq

我有一个2d数组 - List<List<string>>,这个数组有3列。

我希望在所有行的第二列中找到此字符串模板 - 192:19:6_different_numbers:some_numbers_or_symbols192:24:6_different_numbers:some_numbers_or_symbols

例如 - 192:24:123456:5432

1 个答案:

答案 0 :(得分:1)

使用正则表达式匹配你的模式,我的正则表达式可能不完整(我在这里没有想法尝试)

List<List<string>> myStuff = ...;
Regex regex = new Regex("192:(24|19):[0-9]{6}:[0-9A-Za-z]*")
var matchingRows = myStuff.Where(x => regex.IsMatch(x[1]);
相关问题