static void Main(string[] args)
{
int count = 0;
String s = "writeln('Helloa a') tung ('main')";
String patern = @"\'+[\S+\s]*\'";
Regex myRegex = new Regex(patern);
foreach (Match regex in myRegex.Matches(s)) {
Console.WriteLine(regex.Value.ToString());
}
}
运行时显示
'Helloa a') tung ('main'
我不想这样
我想打印
'Helloa a'
'main'
你能帮助我吗?