日期:2014-05-18  浏览次数:20417 次

50分 急解 在javascript中正则表达式拆分字符串!!!
正则表达式获取 "2007-08-30   12:30 "其中的每个时间     "2007 "   "08 "   "30 "   "12 "   "30 "

------解决方案--------------------
var reg=/(\d+)-(\d+)-(\d+)\s+(\d+):(\d+)/;
reg.exec( "2007-08-30 12:30 ")

RegEx.$1==2007
RegEx.$2==08
依次
------解决方案--------------------
try

<script language= "javascript ">
var time = "2007-08-30 12:30 ";
var re = /^(\d{4})-(\d{2})-(\d{2})\s+(\d{2}):(\d{2})$/;
re.test(time);
alert(RegExp.$1);
alert(RegExp.$2);
alert(RegExp.$3);
alert(RegExp.$4);
alert(RegExp.$5);
</script>