21,886
社区成员
发帖
与我相关
我的任务
分享
begin
xxxxxxxxxxxx
end
yyyyyyyyyyyyy
yy....
begin
xxxxxxx
end
...
function GetInformation($content){
$tmpArrayPattern[0] = "/\s+/";
$tmpArrayPattern[1] = "/\t/";
$tmpArrayPattern[2] = "/\n/";
$tmpArrayPattern[3] = "/\r/";
$tmpArrayReplace[0] = "";
$tmpArrayReplace[1] = "<tab>";
$tmpArrayReplace[2] = "<newLine>";
$tmpArrayReplace[3] = "<return>";
ksort($tmpArrayPattern);
ksort($tmpArrayReplace);
$buffer = preg_replace($tmpArrayPattern,$tmpArrayReplace,$content);
return $buffer;
}
$str = "begin
xxxxxxxxxxxx
end
yyyyyyyyyyyyy
yy....
begin
xxxxxxx
end";
preg_match_all("/begin\s+([^\s]+)\s+end/i", $str, $matches);
print_r($matches);