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 给出的正则表达式相匹配的内容。
本文介绍了如何使用PHP中的preg_match函数进行简单的正则表达式验证。通过一个示例展示了如何判断一个字符串是否包含特定模式。
203

被折叠的 条评论
为什么被折叠?



