javascript中如何获取字符串 请高手指教!!
javascript中要获取 "2007-08-23 15:29~16:50 " 这种格式的字符串中的 "15 ", "16 ", "29 ", "50 "字符串,如何获得?
[解决办法]
var reg=/.*?\s+(\d+)\:(\d+)~(\d+)\:(\d+)/i;
reg.exec( "2007-08-23 15:29~16:50 ")
获取结果:
RegExp.$1=15
RegExp.$2=29
类推