<?php
//正则表达式--修饰符一般放在//的外面
//1. i 表示不区分大小写
$model = "/php/";
$string = "php";
echo(preg_match($model, $string));
$model = "/php/";
$string = "PHP";
echo(preg_match($model, $string));
$model = "/php/i";
$string = "PHP";
echo(preg_match($model, $string))."<hr>";
//2. m 表示匹配首位的时候,如果遇到换行,也应该承认是结尾
$model = "/php$/";
$string = "this is php\n, is good";
echo(preg_match($model, $string));
$model = "/php$/m";
$string = "this is php\n, is good";
echo(preg_match($model, $string))."<hr>";
//3. x忽略正则中的空白
$model = "/p h p/";
$string = "php";
echo(preg_match($model, $string));
$model = "/p h p/x";
$string = "php";
echo(preg_match($model, $string))."<hr>";
//4. A表示强制从头开始匹配
$model = "/php/";
$string = "phpdddddddddddd";
echo(preg_match($model, $string));
$model = "/php/";
$string = "ddddddphp";
echo(preg_match($model, $string));
$model = "/php/A";
$string = "ddddddphp";
echo(preg_match($model, $string));
$model = "/php/A";
$string = "phpdddddd";
echo(preg_match($model, $string))."<hr>";
//U:禁止贪婪模式
?>