Home  >  Article  >  Web Front-end  >  提取字符串中年月日的函数代码_基础知识

提取字符串中年月日的函数代码_基础知识

WBOY
WBOYOriginal
2016-05-16 17:17:291598browse

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

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

match方法得到的是一个数组

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn