21,893
社区成员




$str =<<<STR
the theory
my myselef
your yourselef
STR;
数据的最后一行后面没有换行
$str =<<<STR
the theory
my myselef
your yourselef
STR;
数据的最后一行后面有换行
$str = "the theory\nmy myselef\nyour yourselef";
$str =<<<STR
the theory
my myselef
your yourselef
STR;
$reg = '/^([a-zA-Z]+)\s*\1[a-zA-Z]*\s?$/m';
preg_match_all($reg, $str, $result);
print_r($result);
Array
(
[0] => Array
(
[0] => the theory
[1] => my myselef
[2] => your yourselef
)
[1] => Array
(
[0] => the
[1] => my
[2] => your
)
)
windows 中,换行是 \r\n