Hi Jason Wong, > > > The regular expression is already working but how can I reduce the > > > string to have then only 2 lines ? > > Convert the string into an array using explode(). Thank's a lot for this information. I tried this but one thing is not suitable so far for me while using explode. E.g. if have the output of route -n: xxx.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 xxx.x.x.x 0.0.0.0 UG 0 0 0 ppp0 By using this example it's quite easy to analyze all lines due to a correct syntax: $INET_NUM = ereg_replace("[\ ]+([a-z]+)([0-9]{1})","\\1\\2_XrR",$INET_NUM); $sorter = explode("_XrR",$INET_NUM); But it has one weakness. In the case the device (ppp0) is missing somewhere in the output as the user didn't intend to integrate this required information, and by having insight it could be more than 10 lines with 10.000 rules of netfilter, explode will show concerning this example of 3 lines 2 defined arrays and it won't lead to an error as explode doesn't give a return value back which has not been proofed to be exploded with _XrR. As I want to proof the syntax of all lines this is wrong and not usable. What I would need is a function which counts, based on a regular expression, how many times this shema occurs inside of a string. So I can reduce the possibilty to have not an error and I could proof against the missing device by searching for 3 ip addresses followed by spaces and so on. E.g. the above example of explode would show 2 set arrays but with a regular expression which counts all ip addresses and so on it would show 3 lines matching the construct. The difference would lead then to an error message as the user input was wrong. -- 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." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php