using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace ConsoleApplication1
{
class Program
{
static String mytext=@"asfasfsadfsdfasdfdsa
asdfdsafads
asdfadsf
sdfsadf
asdfasdfads";
static void Main(string[] args)
{
Console.WriteLine(mytext);
string pattern = "asd";
MatchCollection mymatches = Regex.Matches(mytext, pattern);
foreach (Match it in mymatches )
Console.WriteLine(it.Value );
Console.ReadKey();
}
}
}
//输出了
// asd
// asd
// asd
// asd
// asd