Parsing File to Get List of Names in C#
<p>I'm parsing my <code>/etc/passwd</code> file, which looks like this:</p>

<pre><code>root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
</code></pre>

<p>I want my program to return the following:</p>

<pre><code>root
bin
daemon
...
sync
</code></pre>

<p>My current code is this:</p>

<pre><code>Regex expression = new Regex(@"^\w*");
foreach (Match myMatch in expression.Matches(txt))
{
    txtout.Text = myMatch.ToString();    
}
</code></pre>

<p>But, I'm only returning <code>root</code> with this code. How can I return every line?</p>
