正则表达式 [\"'](.*?)[\"']
完整的用C#正则表达式提取单引号和双引号中的值的C#语言程序如下
using System;
using System.Text.RegularExpressions;
namespace MatchApplication{
class MatchClass{
static void Main(string[] args){
string s="width= \"680\" height= \"400\" width= '480' height= '400'";
MatchCollection mc =Regex.Matches(s,"[\"'](.*?)[\"']");
foreach (Match m in mc){
Console.WriteLine(m.Groups[1].Value);
}
Console.ReadKey();
}
}
}