<?php/** * Created by PhpStorm. * User: Ollydebug * Date: 2015/11/15 * Time: 15:20 *//* * U-懒惰匹配 * i-忽略英文字母大小写 * x-忽略空白 * s-让元字符' . '匹配包括换行符内所有字符 */$pattern = '/Go Ogle.+123/Uix';$subject = 'I love google_<b style="color:transparent">来&源gao@dai!ma.com搞$代^码%网</b><img>搞gaodaima代码</img>_123123123123123123';$matches = array();preg_match($pattern,$subject,$matches);show($matches);function show($var){ if(empty($var)){ echo 'null'; }elseif(is_array($var)||is_object($var)){ // array,object echo '<pre>'; print_r($var); echo '</pre>'; }else{ //string,int,float echo $var; }}?>
以上就是(PHP)正则表达式-忽略空白的内容,更多相关内容请关注搞代码(www.gaodaima.com)!