当前位置:首页 >> 网络编程

提取字符串中年月日的函数代码

var str="sfsfsfdf2011年sfsdfsf05月随碟附送lfs23日";

str.match(/\d{4}年[01]?\d月[0123]?\d日/g)[0];

match方法得到的是一个数组