惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
P
Proofpoint News Feed
宝玉的分享
宝玉的分享
人人都是产品经理
人人都是产品经理
博客园_首页
爱范儿
爱范儿
博客园 - 叶小钗
aimingoo的专栏
aimingoo的专栏
S
SegmentFault 最新的问题
MyScale Blog
MyScale Blog
阮一峰的网络日志
阮一峰的网络日志
IT之家
IT之家
Microsoft Security Blog
Microsoft Security Blog
Blog — PlanetScale
Blog — PlanetScale
博客园 - 【当耐特】
Y
Y Combinator Blog
量子位
博客园 - 三生石上(FineUI控件)
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
The Blog of Author Tim Ferriss
月光博客
月光博客
有赞技术团队
有赞技术团队
Apple Machine Learning Research
Apple Machine Learning Research
A
About on SuperTechFans

博客园 - shcity

Troubleshooting on TransactionScope Parse string to JSON object Parse date in js blockUI doesn't close when download file in asp.net define namespace in JS Dense_Rank(), Row_Number(), Rank() in sql server reading and writing variable through lock in SSIS script task Fix the issue that cannot open SSIS in BIDS three ways creating custom helpers to show RadioButtonList in MVC using JavaScriptSerializer to serialize object to json using ISerializable to control serialization and deserialization ViewStateAutoManager ReportingService formatting Build my own DataTable split a string into an array through comma div with separated html template - shcity 半透明的div对话框 foreach 的自动转化类型 在Ajax1.0中调用页面CS文件中的方法
正则表达式替换日期
shcity · 2010-12-13 · via 博客园 - shcity

正则表达式替换日期

            string str = @"test_{@ReportDate:yyyyMMdd}\{@ReportDate:yyyy}\{@ReportDate:MM}\{@ReportDate:dd}\ss.xls";
            Regex regex 
= new Regex(@"\{@ReportDate:(?<p>[a-zA-Z]*)\}");
            DateTime time 
= DateTime.Now;string r = regex.Replace(str, match =>
            {
                var p 
= match.Groups["p"].Value;
                var t 
= time.ToString(p);
                
return t;
            });

posted on 2010-12-13 13:24  shcity  阅读(891)  评论(0)    收藏  举报