how to parse a string parse with ereg

From: Date: Fri, 12 Nov 2004 00:50:58 +0000
Subject: how to parse a string parse with ereg
Groups: php.general 
Request: Send a blank email to php-general+get-201807@lists.php.net to get a copy of this message
Hi, I've a string where the output of route -n is in for example. x.x.x.x 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 0.0.0.0 x.x.x.x 0.0.0.0 UG 0 0 0 ppp0 The regular expression is already working but how can I reduce the string to have then only 2 lines ? To explain this I can proof if the first line is set properly. This is already done. So I would like now to delete the first line of the string which includes this data. So I would then have now: 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 0.0.0.0 x.x.x.x 0.0.0.0 UG 0 0 0 ppp0 Then I could test if the second line is set properly which is now the first line and so on. What I need would be a looping possibilty which makes it able to delete every line which is ok so far and so on. As I don't know what routing table a person is using there could be quite a lot of lines which should be proofed concerning the syntax. -- Best Regards, Mark. "Hello, I am brand new to meditation, and I have a frustrating habit of falling asleep in class. I don't know how to stop this. When my teacher tells us to relax our bodies and focus on breathing, my body relaxes, but so does my brain."

« previous php.general (#201807) next »