不得不承认,正则表达式用习惯了,能够大大提高效率。这个分析,很简单就完成了。

Code
Regex reg = new Regex(@"(?<=QN=)(?<QN>\d{17}).*?(?<=CN=)(?<CN>9999)");
MatchCollection mc = reg.Matches(textBox1.Text);
for (int i = 0; i < mc.Count; i++)
{
textBox2.Text += mc[i].Groups["CN"].Value +"\t"+mc[i].Groups["QN"].Value +"\r\n";
}