码迷,mamicode.com
首页 > 其他好文 > 详细

正则表达式_matches

时间:2014-06-20 17:34:06      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:blog   http   com   2014   name      

$name = "abc_2014-06-19.txt"
$name -cmatch ‘^abc_(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})\.txt‘
$matches

bubuko.com,布布扣

$matches.year
$matches.day

 

$id="/cs/blogs/tips/archive/2014/06/12/be-aware-of-side-effects.aspx"
if ($id -cmatch ‘^/cs/blogs/tips/archive/(?<year>\d{4})/(?<month>\d{2})/(?<day>\d{2})/(?<name>.+)\.aspx$‘) {
$year = $matches[‘year‘]
$month = $matches[‘month‘]
$day = $matches[‘day‘]
$name = $matches[‘name‘]
}

$matches

bubuko.com,布布扣

正则表达式_matches,布布扣,bubuko.com

正则表达式_matches

标签:blog   http   com   2014   name      

原文地址:http://www.cnblogs.com/dreamer-fish/p/3796502.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!