Home >Backend Development >PHP Tutorial > 初学PHP正则表达式,这两个婚配的结果为什么不一样呢

初学PHP正则表达式,这两个婚配的结果为什么不一样呢

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:39:43859browse

初学PHP正则表达式,这两个匹配的结果为什么不一样呢?

$str="s{title}dfsd{author}323{con}jf2l3k1sdjf";

$mode="/{(.*)}/U";

preg_match($mode,$str,$arr);

print_r($arr);

 ?>


$str="s{title}dfsd{author}323{con}jf2l3k1sdjf";

$mode="/{.*}/U";

preg_match($mode,$str,$arr);

print_r($arr);

 ?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn