$str = "http://www.google.com"; $preg= "/http:\/\/\w+\.\w+.(?:net|com|cn)+/is"; $preg2= "/http:\/\/\w+\.\w+.(net|com|cn)+/is"; preg_match($preg,$str,$arr); preg_match($preg2,$str,$arr2);
$str='hello world china'; $preg="/\w+\s/is"; preg_match($preg,$str,$arr); print_r($arr); preg_match_all($preg,$str,$arr); print_r($arr);
$str = "13521899942a";
$preg="/1[\d]{3,15}/is";
if (preg_match($preg,$str,$arr)) {
echo "ok";
}
$str = "13521899942a";
$preg="/1[\d]{3,15}$/is";
if (preg_match($preg,$str,$arr)) {
echo "ok";
}
$str='hello world'; $preg='/\w+$/ism';//$preg='/(?m)\w+$/is'; preg_match_all($preg,$str,$arr); print_r($arr);
$str ="email:ywdblog@gmail.com;";
preg_match("/email:(?<email>\w+?)/is", $str, $matches);
echo $matches["email"] . "_" . $matches['no'];
$str = "<h2>hello</h2><h2>world</h2>"; $preg = "/<h2>.*<\/h2>/is"; preg_match($preg,$str,$arr); print_r($arr);
$str = "<h2>hello</h2><h2>world</h2>"; $preg = "/<h2>.*?<\/h2>/is"; preg_match($preg,$str,$arr); print_r($arr);
$str= 'jiangsu (nanjing) nantong guangdong (guangzhou) zhuhai beijing (tongzhou) haidian'; $preg = '/^\s*+([^(]+?)\s\(([^)]+)\)\s+(.*)$/m'; preg_match_all($preg,$str,$arr,PREG_PATTERN_ORDER); print_r($arr); preg_match_all($preg,$str,$arr,PREG_SET_ORDER); print_r($arr);
$str = "china hello world";
$preg = '/\b(\w+)(\w)\b/';
function fun($m){
return $m[1].strtoupper($m[2]);
}
echo preg_replace_callback($preg,"fun",$str);
$str = '\\*china*world';
$preg = "\*china";
$preg = preg_quote($preg);
echo $preg;
preg_match( "/{$preg}/is",$str,$arr);
print_r($arr);
$str = "http://www.google.com"; $str = "https://www.google.com"; $preg = '/[a-z]+(?=:)/'; preg_match($preg,$str,$arr); print_r($arr);
$str = ("chinaWorldHello");
$preg = "/(?=[A-Z])/";
$arr = preg_split($preg,$str);
print_r($arr);
$str= "HelloWorld2016";
if (preg_match("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $str,$arr)){
print_r($arr);
}
$str = 'chinadhello'; $preg = '/(?<=a)d(?=h)/'; preg_match($preg, $str, $arr); print_r($arr);
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有