- 贪婪匹配:匹配结果存在歧义时取其长
- 懒惰匹配:匹配结果存在歧义时取其短 U
- 举例
$pattern = ‘/sjm.+123/’
$subject = ‘sdfsjmdsj1545123123123’
注意: (1)默认使用贪婪模式(2)设置懒惰模式:$pattern = ‘/sjm.+123/U’
- 注: x忽略空白是只能忽略的pattern中的空白。
$pattern = ‘/sjm.+123/’
$subject = ‘sdfsjmdsj1545123123123’
$pattern = ‘/sjm.+123/U’