<?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__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 class="brush:php;toolbar:false">'; print_r($var); echo ''; }else{ //string,int,float echo $var; } } ?>
The above is the (PHP) regular expression - ignore the blank content. For more related content, please pay attention to the PHP Chinese website (m.sbmmt.com)!