Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/259.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何跳过一列?_C#_Regex - Fatal编程技术网

C# 如何跳过一列?

C# 如何跳过一列?,c#,regex,C#,Regex,我有一个文本表: 13.5 0.12557 0.04243 -0.0073 0.00377 14 0.12573 0.05 -0.00697 0.00437 14.5 0.12623 0.05823 -0.00703 0.005 15 0.12853

我有一个文本表:

   13.5         0.12557         0.04243         -0.0073         0.00377
     14         0.12573            0.05        -0.00697         0.00437
   14.5         0.12623         0.05823        -0.00703           0.005
     15         0.12853          0.0686        -0.00627         0.00493
   15.5          0.1299         0.08073        -0.00533          0.0063
我想匹配所有数字,除了第一列中的数字。 我曾尝试过使用负面回顾,但没有成功:

(?<!^)[\d.E-]+
(?

如何匹配除第一列(13.5、14、14.5、15、15.5)之外的所有数字?

请注意,如果您不关心数据验证,您可以在此处不使用正则表达式:

var results = line.Split(new[] {"\r", "\n"}, StringSplitOptions.RemoveEmptyEntries)
            .Select(v => v.Split(new[] {" "}, StringSplitOptions.RemoveEmptyEntries).Skip(1))
            .SelectMany(x => x);
Console.WriteLine(string.Join(",",results));
// => 0.12557,0.04243,-0.0073,0.00377,0.12573,0.05,-0.00697,0.00437,0.12623,0.05823,-0.00703,0.005,0.12853,0.0686,-0.00627,0.00493,0.1299,0.08073,-0.00533,0.0063
如果您只想在数据为数字时匹配这些数字,您可以使用

    var results2 = Regex.Matches(line, @"(?m)(?<!^[\p{Zs}\t]*)(?<=[\p{Zs}\t])-?[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?")
            .Cast<Match>()
            .Select(m => m.Value);

var results2=Regex.Matches(行,@“(?m)(?试试。或者如果你想过滤掉第一列。@Wiktor Stribiżew:对不起,什么是\h和\K?我在RegexBuddy上尝试,但它不识别它。但是,我的目标是C#。
\h
是水平空白,
\K
让引擎放弃它迄今为止匹配的内容。@jan,如果我设置了PCRE,那么\K和\h被识别,h不过,当我将目标语言设置为C#。。。