Home  >  Article  >  Backend Development  >  PHP regular matching string whether there is date data_PHP tutorial

PHP regular matching string whether there is date data_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:13:181233browse

Today we will talk about a super simple and practical example, which is to tell you how to use the preg_match function to match whether the string has the content we want. Let's take matching date as an example.

 代码如下 复制代码
if(preg_match("/d{4}-d{2}-d{2}/","开始大幅拉萨大家2012-02-02 12:12:12舍得离开房间")){
echo 'ye';
}else{
echo 'no';
}

?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629222.htmlTechArticleToday we will tell you a super simple and practical example, which is to tell you how to use the preg_match function to match whether a string is What we want, let’s take the matching date as the actual content...
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