PHP的preg_match正则表达式

preg_match可验证一些正则表达式:

<?php 
	//phpinfo();
	$str = test12346;
	if (preg_match('/test/i', $str))
	{
		echo 'status ok';		
	} else {
		echo 'status error';
	}
?>

 

在PHP手册中的preg_match函数介绍是,

nt preg_match ( string pattern, string subject [, array matches [, int flags]] )

 

在 subject 字符串中搜索与 pattern 给出的正则表达式相匹配的内容。

 

你可能感兴趣的:(正则表达式)