I'm stuck at this question and hope any one out there can help me.
I have a config file that contains following lines:
config system interface
edit "internal1"
set vdom "root"
set ip 192.168.1.1 255.255.255.0
set allowaccess ping https ssh http fgfm capwap
set type physical
set snmp-index 1
next
edit "internal2"
set vdom "root"
set ip 192.168.20.2 255.255.255.0
set allowaccess ping https ssh http fgfm capwap
set type physical
set snmp-index 2
Set secondary-IP enable
config secondaryip
edit 1
set ip 192.168.21.2 255.255.255.0
next
edit 2
set ip 192.168.22.2 255.255.255.0
next
end
next
edit "internal3"
set vdom "root"
set ip 192.168.30.3 255.255.255.0
set allowaccess ping https ssh http fgfm capwap
set type physical
set snmp-index 3
Set secondary-IP enable
config secondaryip
edit 1
set ip 192.168.31.3 255.255.255.0
next
end
next
end
....
And want to Match for interface's Name, vdom, vlanid, ip and secondary-ip(s) with following regex:
preg_match_all("/edit .+(\s+config secondaryip\r?\n(\s+edit \d+\r?\n.+\s+next\r?\n){1,}\s+end\r?\n)?.+next\r?\n/s", $configFile, $matched_interfaces);
with the first .+ is everything matched and not the others!
Thx for any suggestions