i need to parse dhcp leases table with php regex. but the thing is it contains different characters used in regex too.
Burada örnek çıktı
lease 172.17.2.3 {
starts 4 2009/07/16 11:54:39;
ends 4 2009/07/16 12:54:39;
cltt 4 2009/07/16 11:54:39;
binding state active;
next binding state free;
hardware ethernet 00:50:56:c0:00:01;
uid "\001\000PV\300\000\001";
client-hostname "Yasin-PC";
}
lease 172.17.2.3 {
starts 4 2009/07/16 12:24:39;
ends 4 2009/07/16 13:24:39;
cltt 4 2009/07/16 12:24:39;
binding state active;
next binding state free;
hardware ethernet 00:50:56:c0:00:01;
uid "\001\000PV\300\000\001";
client-hostname "Yasin-PC";
}
lease 172.17.2.3 {
starts 4 2009/07/16 12:54:39;
ends 4 2009/07/16 13:54:39;
cltt 4 2009/07/16 12:54:39;
binding state active;
next binding state free;
hardware ethernet 00:50:56:c0:00:01;
uid "\001\000PV\300\000\001";
client-hostname "Yasin-PC";
}
Sorun i xx.xx.xx.xx ... {.. kira sonra ip adresleri ile endeksli bir diziye bütün tablo atamak istiyoruz ve bir Orada yinelenen anahtarlar olacak ama değerler yüzden bu çözmek için gereken farklı olacak ...
what would you advice me to save my time to build a good regex for this ? posix or pcre or reading line by line ?
& i can not be sure about target leases table will be all in the same format. maybe some times a few more lines i expect.