Re: Zero-suppression Regex

2002-02-18 Thread Dirk Bremer
Alistair, The input data consists of numeric strings created in two different formats form two different platforms, one having leading signs and one having trailing signs. The commify will ignore the trailing signs, which is fine for my requirements, unless someone wants to propose another rege

Re: Zero-suppression Regex

2002-02-17 Thread $Bill Luebkert
Carl Jolley wrote: > On Fri, 15 Feb 2002, Dirk Bremer wrote: > > >>$Bill, it was not you who made a mistake with the benchmark, it was I and in the >process learned a lot of new things about the >>Benchmark module, which is a wonderful tool and should be used by anyone who is >interested in p

Re: Zero-suppression Regex

2002-02-17 Thread Carl Jolley
On Fri, 15 Feb 2002, Dirk Bremer wrote: > $Bill, it was not you who made a mistake with the benchmark, it was I and in the >process learned a lot of new things about the > Benchmark module, which is a wonderful tool and should be used by anyone who is >interested in performance. This is my revi

RE: Zero-suppression Function (was Zero-suppression Regex)

2002-02-15 Thread Frazier, Joe Jr
> Reply-To: "Dirk Bremer" <[EMAIL PROTECTED]> > From: "Dirk Bremer" <[EMAIL PROTECTED]> > To: "'Perl Win32 Users Mailing List'" > <[EMAIL PROTECTED]> > Subject: Re: Zero-suppression Regex > Date: Thu, 14 Feb 2002 1

Re: Zero-suppression Regex

2002-02-14 Thread $Bill Luebkert
Dirk Bremer wrote: > Here is a quicker version of the zero-suppression routine that will also float a >leading sign character: > > sub ZeroSuppress2($) > { > my $self = shift; > > # Return if the argument is less than two digits. > return($self) if (length($self

Re: Zero-suppression Regex

2002-02-14 Thread Dirk Bremer
Here is a quicker version of the zero-suppression routine that will also float a leading sign character: sub ZeroSuppress2($) { my $self = shift; # Return if the argument is less than two digits. return($self) if (length($self) < 2); # Search for a embed

Re: Zero-suppression Regex

2002-02-12 Thread Dirk Bremer
Alistair, No need to fall off of the horse, you will get bruised that way. Sometimes you have to point your horse in a different direction to view the horizon. Note the following: { use Benchmark; timethese(10, {'sprintf' => sub {my $num = '0.00';$num = sprintf('%1.

RE: Zero-suppression Regex

2002-02-12 Thread Alistair . McGlinchy
> -Original Message- > From: Dirk Bremer [SMTP:[EMAIL PROTECTED]] > Sent: Tuesday, February 12, 2002 6:52 PM > To: 'Perl Win32 Users Mailing List' > Subject: Re: Zero-suppression Regex > > In my instance, the 0+ solution would not produce the results I

Re: Zero-suppression Regex

2002-02-12 Thread Dirk Bremer
February 12, 2002 11:36 Subject: RE: Zero-suppression Regex > As Michael G Schwern over on the Fun With Perl group said: > > Folks, I'm clawing my eyes out here. Stop hitting the regex crack > pipe! > > Although he was specifically talking about printf vs a regex for zero >

RE: Zero-suppression Regex

2002-02-12 Thread Joseph P. Discenza
[EMAIL PROTECTED] wrote, on Tuesday, February 12, 2002 12:36 PM : Why not just use 0+$_ and let perl work its magic. I challenge any of you : regex "pushers" out there to write a regex that beats this in either speed : or elegance. Oh, of course. Duh. I had blinders on from the OP's subject line.

Re: Zero-suppression Regex

2002-02-10 Thread Jim Angstadt
Very nice. Thanks. --- Jim --- $Bill Luebkert <[EMAIL PROTECTED]> wrote: > use strict; > > my @nums = qw(00123 04 004.01 000 00 0 .0 0.01 > 0012.001 000.0001); > $_ = join ' ', @nums; # save orig for bottom part > > foreach (@nums) { > print "$_ => "; > s/(? print "$_\n";

Re: Zero-suppression Regex

2002-02-10 Thread $Bill Luebkert
Jim Angstadt wrote: > Dear Joe and Dirk, > > Thanks for getting me to look at assertions. > > Expanding the requirement a little, > here is what I have so far: > > my @nums = qw/ 00123 04 004.01 000 00 0 .0 >0.01 0012.001 000.0001 /; > foreach ( @nums ) { >s/(\b)0+(?=\d)(\

Re: Zero-suppression Regex

2002-02-10 Thread Jim Angstadt
Dear Joe and Dirk, Thanks for getting me to look at assertions. Expanding the requirement a little, here is what I have so far: my @nums = qw/ 00123 04 004.01 000 00 0 .0 0.01 0012.001 000.0001 /; foreach ( @nums ) { s/(\b)0+(?=\d)(\.*.*)/$1$2/g; # fails on 0.01 print $_,