Reply to Re: [PHP] Seemingly weird regex problem

Your name:

Reply:


Posted by Tim Boring on 01/20/05 21:21

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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация