Home >Backend Development >PHP Tutorial >(PHP) Regular expression - ignore case
<?php /** * Created by PhpStorm. * User: Ollydebug * Date: 2015/11/15 * Time: 15:20 */ /* * U-懒惰匹配 * i-忽略英文字母大小写 * x-忽略空白 * s-让元字符' . '匹配包括换行符内所有字符 */ $pattern = '/GoOgle.+123/Ui'; $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 (PHP) regular expression - ignore case content. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!