If your file has this specific structure, you do not need to use Regex
. Just use Split(" ")
and the result array for each line.
Regex
has performance penalties.
But if you like to use Regex
anyway, you can use Regex.Match(line, "[\S]+ [\S]+ [\S]+")
for this file structure.