RE: [PHP] Seemingly weird regex problem

2005-01-21 Thread Ford, Mike
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 20 January 2005 20:36, Tim Boring wrote: > On Thu, 2005-01-20 at 14:40, Bret Hughes wrote: > > On Thu, 2005-01-20 at 12:43, Jason Wong wrote: > > > On Friday 21 January 2005 02:1

Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Jochem Maas
Tim Boring wrote: Hello! I'm having an odd regex problem. Here's a summary of what I'm trying to accomplish: I've got a report file generated from our business management system (Progress 4GL), one fixed-width record per line. I've got a php script that reads in the raw file one line at a time,

RE: [PHP] Seemingly weird regex problem

2005-01-20 Thread Tim Boring
On Thu, 2005-01-20 at 15:13, Michael Sims wrote: > Tim Boring wrote: > > On Thu, 2005-01-20 at 13:41, Jason Wong wrote: > >> I suspect what you want to be doing is something like this: > >> > >> switch (TRUE) { > >> case ANY_EXPRESSION_THAT_EVALUATES_TO_TRUE: > >> ... > >> } > > > > Tha

Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Bret Hughes
On Thu, 2005-01-20 at 14:06, Bret Hughes wrote: > > I think I see a possible explanation for the behavior. preg_replace > does not return a true or false value it returns the string passed as > the subject with any matched replacements done. Hmm the manual says it > better: > > If matches are

Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Tim Boring
On Thu, 2005-01-20 at 13:43, Jason Wong wrote: > On Friday 21 January 2005 02:16, Tim Boring wrote: > > > It's perfectly legit to use expressions. Now perhaps there is something > > wrong with the regex I'm trying to use, but using a regex in and of > > itself is legal. > > http://www.php.net/man

Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Tim Boring
On Thu, 2005-01-20 at 14:40, Bret Hughes wrote: > On Thu, 2005-01-20 at 12:43, Jason Wong wrote: > > On Friday 21 January 2005 02:16, Tim Boring wrote: > > > > > It's perfectly legit to use expressions. Now perhaps there is something > > > wrong with the regex I'm trying to use, but using a regex

RE: [PHP] Seemingly weird regex problem

2005-01-20 Thread Michael Sims
Tim Boring wrote: > On Thu, 2005-01-20 at 13:41, Jason Wong wrote: >> 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 >

Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Bret Hughes
On Thu, 2005-01-20 at 13:21, Tim Boring wrote: > 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

Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Richard Lynch
Tim Boring wrote: > 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 .

Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Jason Wong
On Friday 21 January 2005 03:21, Tim Boring wrote: > 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'v

Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Richard Lynch
Tim Boring wrote: > It's perfectly legit to use expressions. Now perhaps there is something > wrong with the regex I'm trying to use, but using a regex in and of > itself is legal. > http://www.php.net/manual/en/control-structures.switch.php Ah... Well, the User Contributed notes provide some ex

Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Bret Hughes
On Thu, 2005-01-20 at 12:43, Jason Wong wrote: > On Friday 21 January 2005 02:16, Tim Boring wrote: > > > It's perfectly legit to use expressions. Now perhaps there is something > > wrong with the regex I'm trying to use, but using a regex in and of > > itself is legal. > > http://www.php.net/man

Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Tim Boring
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)

Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Jason Wong
On Friday 21 January 2005 02:16, Tim Boring wrote: > It's perfectly legit to use expressions. Now perhaps there is something > wrong with the regex I'm trying to use, but using a regex in and of > itself is legal. > http://www.php.net/manual/en/control-structures.switch.php Yes, but comparing th

Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Jason Wong
On Friday 21 January 2005 01:52, Tim Boring wrote: > To try to help spot the issue, I put in the if(preg_match("/^\W+/", > $line)) logic, and the weird thing is that this logic isn't outputting > the line beginning with things like "AKRN", yet the same line is getting > caught in the switch statem

Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Tim Boring
On Thu, 2005-01-20 at 12:59, Richard Lynch wrote: > Tim Boring wrote: > > Hello! I'm having an odd regex problem. Here's a summary of what I'm > > trying to accomplish: > > > switch ($line) > > { > > case ($total_counter <= 5): > > break; > >case preg_match("/^\W+

Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Bret Hughes
On Thu, 2005-01-20 at 11:59, Richard Lynch wrote: > Tim Boring wrote: > > Hello! I'm having an odd regex problem. Here's a summary of what I'm > > trying to accomplish: > > > switch ($line) > > { > > case ($total_counter <= 5): > > break; > >case preg_match("/^\W+

Re: [PHP] Seemingly weird regex problem

2005-01-20 Thread Richard Lynch
Tim Boring wrote: > Hello! I'm having an odd regex problem. Here's a summary of what I'm > trying to accomplish: > switch ($line) > { > case ($total_counter <= 5): > break; >case preg_match("/^\W+/", $line): While it would be Really Nifty (tm) if PHP worked this

[PHP] Seemingly weird regex problem

2005-01-20 Thread Tim Boring
Hello! I'm having an odd regex problem. Here's a summary of what I'm trying to accomplish: I've got a report file generated from our business management system (Progress 4GL), one fixed-width record per line. I've got a php script that reads in the raw file one line at a time, and "strips" out