Text = System.Text.RegularExpressions.Regex.Match( textBox1.Text, "([^\r\n]*\r\n){9}((?<Line>[^\r\n]*)(\r\n)*)" ).Result("${Line}");
using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Text.RegularExpressions;namespace ConsoleApplication76 { class Program { static void Main(string[] args) { int n = 10; //string text = new StreamReader("C:\\a.txt").ReadToEnd(); string text = @"1 24 5asdf 6 7 8 9 10 "; Match m = Regex.Match(text, ".+"); while (--n > 0) m = m.NextMatch(); Console.WriteLine(m); Console.Read(); } } }
textBox1.Text, "([^\r\n]*\r\n){9}((?<Line>[^\r\n]*)(\r\n)*)"
).Result("${Line}");
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;namespace ConsoleApplication76
{
class Program
{
static void Main(string[] args)
{
int n = 10;
//string text = new StreamReader("C:\\a.txt").ReadToEnd();
string text =
@"1
24
5asdf
6
7
8
9
10
";
Match m = Regex.Match(text, ".+");
while (--n > 0)
m = m.NextMatch();
Console.WriteLine(m);
Console.Read();
}
}
}