读书人

这个正则表达式怎么写

发布时间: 2012-06-16 20:34:32 作者: rapoo

这个正则表达式如何写?
对于下面的字符串,我想分别获取冒号后的信息,如何写正则表达式

Content-Type: application/msword;
name="readme.doc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename=" readme.doc "


[解决办法]
看看这个能否达到要求

C# code
 Regex reg = new Regex(@"(?<=[::""][\s\t]*)[^\n"";;\s]+(?=[\s\t]*[;"";\n])");            string input = @"Content-Type: application/msword;  name=""readme.doc""Content-Transfer-Encoding: base64Content-Disposition: attachment;  filename="" readme.doc """;            foreach (Match m in reg.Matches(input))                Console.WriteLine(m.Value);//printapplication/mswordreadme.docbase64attachmentreadme.doc 

读书人网 >C#

热点推荐