Re: how to parse a string parse with ereg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 18 November 2004 06:51, Mark-Walter@xxxxxxxxxxx wrote:

> Well this work's fine in the case the user input is correct :-)
>
> But it's not required to proof in the case I would assume that a
> user input is correct.
>
> To explode with the device as line break to allocate an array mem
> lead's not to an error as this line it won't be in the array.

I meant explode each *line* (at the EOL character(s)), so this:

xxx.x.x.x |  0.0.0.0 255.255.255.255 UH 0 |  |  | 0 |  |  |  | 0 ppp0

is an element of the array. And this:

192.168.0.0 0.0.0.0 255.255.255.0 U |  | 0 |  |  | 0 |  |  |  | 0 eth1

is another element, etc.

> 0.0.0.0 |  |  xxx.x.x.x 0.0.0.0 |  |  UG |  0 |  |  | 0 |  |  |  | 0
>
> E.g. Line 3 won't be in an array. This could maybe be caused from
> drop & paste to copy from a shell into the browser while using
> an extraordinary OS.

Then you can process each line separately but in groups 3 lines at a time 
(assuming they're supposed to be groups of 3).

> ***
> The only solution which should be better now for me is to proof
> for 3 ip addresses in a row to be able to count how much
> of this matching construct in a result is as basis for a difference.
> Then I'am able to compare this with matching lines where the
> device has been taken to explode.
>
> The difference lead's now to an error as the syntax is wrong.

If you state clearly, in detail, what exactly you want the regex to match then 
maybe someone could construct a better one for you. 

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
* Knghtbrd crosses his toes
<Knghtbrd> (if I crossed my fingers it would be hard to type)
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux