我有以下输入数据(请注意,一些空白被弄乱了):
aggr0_howzeg253_sata online raid_dp,aggr root,diskroot,nosnap=off,raidtype=raid_dp,32 位 raidsize=14,ignore_inconsistent=off,snapmirrored=off,resyncsnaptime=60,fs_size_fixed=off,snapshot_autodelete=on,lost_write_protect=on,ha_policy=首席财务官,hybrid_enabled=off,percent_snapshot_space=5%,free_space_realloc=off
Volumes: root_vol_howzeg253, howzeg253_ixb_esx_vol16_sv_mirror, howzeg253_ixb_esx_vol5_sv_mirror, howzeg253_ixb_esx_vol18_sv_mirror, howzeg253_ixb_esx_vol21_sv_mirror, howzeg253_ixb_esx_vol33_sv_mirror, howzeg253_ixb_esx_vol24_sv_mirror, howzeg253_ixb_esx_vol34_sv_mirror Plex /aggr0_howzeg253_sata/plex0: online, normal, active RAID group /aggr0_howzeg253_sata/plex0/rg0: normal, block checksums RAID group /aggr0_howzeg253_sata/plex0/rg1: normal, block checksums
aggr1_howzeg253_sata online raid_dp,aggr nosnap=off,raidtype=raid_dp,raidsize=14,32 位 ignore_inconsistent=off,snapmirrored=off,resyncsnaptime=60,fs_size_fixed=off,snapshot_autodelete=on,lost_write_protect=on,ha_policy=cfo,hybrid_enabled=关闭,percent_snapshot_space=5%,free_space_realloc=off
Volumes: howzeg253_ixb_esx_vol6_sv_mirror, howzeg253_ixb_esx_vol17_sv_mirror, howzeg253_ixb_esx_vol7_sv_mirror, howzeg253_ixb_esx_vol19_sv_mirror, howzeg253_ixb_esx_vol23_sv_mirror, howzeg253_ixb_esx_vol8_sv_mirror, howzeg253_ixb_esx_vol36_sv_mirror Plex /aggr1_howzeg253_sata/plex0: online, normal, active RAID group /aggr1_howzeg253_sata/plex0/rg0: normal, block checksums RAID group /aggr1_howzeg253_sata/plex0/rg1: normal, block checksums
我将此表达式与 preg_match_all 一起使用:
preg_match_all("|(aggr[a-z0-9_]+)\s+.*Volumes.\s+(.*)\s+Plex.*checksums|s", $rawdata, $out);
然而,我得到的输出只给了我来自第一个块的信息(看起来解析正确;每个块都以 aggr_... 在一行的开头)。我尝试了不同的方法,但无法得到我想要的(比如表达式开头带有胡萝卜的多行,以及 s 修饰符)。
所以这是我得到的输出:
...
[1] => Array
(
[0] => aggr4_delng153_sas_sata
)
[2] => Array
(
[0] => delng153_ixb_esx_vol19, delng153_ixb_esx_vol20,
delng153_ixb_esx_vol21, delng153_ixb_esx_vol28,
delng153_ixb_esx_vol29, delng153_ixb_esx_vol30,
delng153_ixb_esx_vol31
)
我也希望返回第二个块。有谁可以帮我离开这里吗?
提前致谢!