Re: Seemingly weird regex problem

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

 



On Thu, 2005-01-20 at 13:41, Jason Wong wrote:
> On Friday 21 January 2005 01:52, Tim Boring wrote:
> 
> Well the biggest problem in your code right now is your incomprehensible (to 
> me anyway) use of the switch construct. For a start I've no idea why you're 
> using ...
> 
> >     switch ($line)
> 
> ... when your tests do not involve $line
> 
> >         case ($total_counter <= 5):

I see your point, but the other tests do involve $line. This one that
you reference I'm using for a "special need"--basically so I leave in
the initial column headings from the report, because they would match
several of the tests that would discard those lines.

> 
> I suspect what you want to be doing is something like this:
> 
>   switch (TRUE) {
>     case ANY_EXPRESSION_THAT_EVALUATES_TO_TRUE:
>     ...
>   }

Thanks for the suggestion, but I'm not sure that does what I'm looking
for.  I really think the problem is with my regex, not necessarily with
the way I've constructed my switch statement.

I say this because I have since changed the first word in each line from
something like "AKRN" to a numeric value, and everything works just as I
would expect it to.  So it seems as if the "^" might be negating the \W+
part of the regex.  Although that shouldn't be happening because "^"
only acts as a negation when it's used inside brackets, at least
according the documentation.

Again, thanks for the suggestion!

Tim

-- 
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