/**
* PHP通过正则表达式进行字符串搜索的简单范例
*
* @param
* @arrange 512-笔记网: www.512Pic.com
**/
$string_to_search = "w3mentor.com";
$regex = "/tor/";
$num_matches = preg_match($regex,$string_to_search);
if ($num_matches > 0) {
echo "Found a match!";
} else {
echo "No match. Sorry.";
}
/*** 来自编程之家 jb51.cc(jb51.cc) ***/