Re: reg exp help please

2003-12-08 Thread Michael D. Smith
 Where did you find the word student anywhere in the post ?...
 Nowhere did it say that you have to use spliti either.
I agree that nowhere did it say any of that. That was just me reading 
between the lines -- except that she has said in the past that she's a 
student (and the .edu on the email is kind of a giveaway).

I could be wrong -- but I don't think so :)

I suppose I should've specified all that too, and didn't, but in general I 
tend to write to much rather than to little so I try to keep it down.

In fact, I'm just assuming it's a she. Lori, first letter last name D -- 
but who knows? I have heard of a boy named Sue:)

ms

 please trim your posts.

Trimed...

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: reg exp help please

2003-12-07 Thread Rob Dixon
lorid wrote:

 Here is the string Im trying to split (its a cookie str)
 MadHatter Data:

a:7:{i:0;s:19:\MadhatterSize=Adult\;i:1;s:20:\MadHatterColors=blue\;i:2;s:15:\MadHatter_Qty=1\;i:3;s:26:\product_name=Madhatt
er_Hat\;i:4;s:8:\cd_num=2\;i:5;s:4:\x=39\;i:6;s:4:\y=12\;}

 the data I want is

 MadhatterSize=Adult,MadHatterColors=blue,MadHatter_Qty=1,product_name=Madhatter_Hat

 I have tried :  syntax is spliti(regexp patter,str,max split)
   spliti(:,$my_Propellar_Data,15);

 the above is the only regexp that works so far , but doesnt come close
 to matching what I want.

Hmm. Well, there's a lot of information in there which ought to be checked
if you're writing live code. I started by splitting the record on semicolon,
and saw that there are a series of i:N and s:N values that have the index
number (starting at zero) and the size of each following item of data. In
addition you have double-quotes escaped by a preceding backslash (which
the count ignores) and the whole thing is contained within a pair of braces
with an a:N value showing the number of fields.

So, my advice is to start by splitting on semicolons. If you need something
robust then expect to write something a lot cleverer.

HTH,

Rob



My output:

a:7:{i:0
s:19:\MadhatterSize=Adult\
i:1
s:20:\MadHatterColors=blue\
i:2
s:15:\MadHatter_Qty=1\
i:3
s:26:\product_name=Madhatter_Hat\
i:4
s:8:\cd_num=2\
i:5
s:4:\x=39\
i:6
s:4:\y=12\
}

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: reg exp help please

2003-12-07 Thread $Bill Luebkert
lorid wrote:

 Here is the string Im trying to split (its a cookie str)
 MadHatter Data:
 a:7:{i:0;s:19:\MadhatterSize=Adult\;i:1;s:20:\MadHatterColors=blue\;i:2;s:15:\MadHatter_Qty=1\;i:3;s:26:\product_name=Madhatter_Hat\;i:4;s:8:\cd_num=2\;i:5;s:4:\x=39\;i:6;s:4:\y=12\;}
 
 the data I want is
 
 MadhatterSize=Adult,MadHatterColors=blue,MadHatter_Qty=1,product_name=Madhatter_Hat
 
 I have tried :  syntax is spliti(regexp patter,str,max split)
   spliti(:,$my_Propellar_Data,15);
 
 the above is the only regexp that works so far , but doesnt come close
 to matching what I want.

$_ = 
q(a:7:{i:0;s:19:MadhatterSize=Adult;i:1;s:20:MadHatterColors=blue;i:2;s:15:MadHatter_Qty=1;i:3;s:26:product_name=Madhatter_Hat;i:4;s:8:cd_num=2;i:5;s:4:x=39;i:6;s:4:\y=12};);

my @args = $_ =~ /(.*?)/g;
print join (',', @args[0..3]), \n;


-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Fwd: Re: reg exp help please

2003-12-07 Thread Michael D. Smith
The thing is lorid is the student. If she's trying to use spliti

spliti(regexp patter,str,max split)
spliti(:,$my_Propellar_Data,15);
That's probably the assignment, and while There Is More Than One Way To Do 
It, doing it their way is the path to student Nirvana.

I've never seen spliti before, and I do read this stuff -- on occasion. 
That's the value of an education I guess :)

ms


From: $Bill Luebkert [EMAIL PROTECTED]
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) 
Gecko/20030624 Netscape/7.1 (ax)
X-Accept-Language: en-us, en
To: lorid [EMAIL PROTECTED]
CC: perl users [EMAIL PROTECTED]
Subject: Re: reg exp help please
X-PMX-Version: 4.0.1.69468
X-PMX-Version: 4.1.0.84286
X-PerlMx-Spam: Gauge=, Probability=8%, Report='SUPERLONG_LINE 
0.003, X_ACCEPT_LANG 0, EMAIL_ATTRIBUTION 0, QUOTED_EMAIL_TEXT 0, 
SIGNATURE_SHORT_DENSE 0, REFERENCES 0.000, IN_REP_TO 0, USER_AGENT 0.000'
Sender: [EMAIL PROTECTED]
X-BeenThere: [EMAIL PROTECTED]
X-Mailman-Version: 2.0.5
List-Unsubscribe: 
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users,

mailto:[EMAIL PROTECTED]
List-Id: Discussions relating to ActivePerl on Win32 platforms 
perl-win32-users.listserv.ActiveState.com
List-Post: mailto:[EMAIL PROTECTED]
List-Help: 
mailto:[EMAIL PROTECTED]
List-Subscribe: 
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users,

mailto:[EMAIL PROTECTED]
List-Archive: http://mailarchive.activestate.com/browse/perl-win32-users/
Date: Sun, 07 Dec 2003 18:37:24 -0800
X-Note: This E-mail was scanned for spam.
X-RCPT-TO: [EMAIL PROTECTED]
lorid wrote:

 Here is the string Im trying to split (its a cookie str)
 MadHatter Data:
 
a:7:{i:0;s:19:\MadhatterSize=Adult\;i:1;s:20:\MadHatterColors=blue\;i:2;s:15:\MadHatter_Qty=1\;i:3;s:26:\product_name=Madhatter_Hat\;i:4;s:8:\cd_num=2\;i:5;s:4:\x=39\;i:6;s:4:\y=12\;}

 the data I want is

 
MadhatterSize=Adult,MadHatterColors=blue,MadHatter_Qty=1,product_name=Madhatter_Hat

 I have tried :  syntax is spliti(regexp patter,str,max split)
   spliti(:,$my_Propellar_Data,15);

 the above is the only regexp that works so far , but doesnt come close
 to matching what I want.

$_ = 
q(a:7:{i:0;s:19:MadhatterSize=Adult;i:1;s:20:MadHatterColors=blue;i:2;s:15:MadHatter_Qty=1;i:3;s:26:product_name=Madhatter_Hat;i:4;s:8:cd_num=2;i:5;s:4:x=39;i:6;s:4:\y=12};);

my @args = $_ =~ /(.*?)/g;
print join (',', @args[0..3]), \n;
--
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic 
http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Fwd: Re: reg exp help please

2003-12-07 Thread $Bill Luebkert
Michael D. Smith wrote:

Firstly - please trim your posts.

 The thing is lorid is the student. If she's trying to use spliti

Where did you find the word student anywhere in the post ?

 spliti(regexp patter,str,max split)
 spliti(:,$my_Propellar_Data,15);
 
 That's probably the assignment, and while There Is More Than One Way To Do 
 It, doing it their way is the path to student Nirvana.

There is no function called spliti in Perl core.  I can only assume it's
a function they have or from some module.  Nowhere did it say that you
have to use spliti either.

 I've never seen spliti before, and I do read this stuff -- on occasion. 
 That's the value of an education I guess :)

If spliti needs to be used, the least they can do is post the source.

lorid wrote:


Here is the string Im trying to split (its a cookie str)
MadHatter Data:


a:7:{i:0;s:19:\MadhatterSize=Adult\;i:1;s:20:\MadHatterColors=blue\;i:2;s:15:\MadHatter_Qty=1\;i:3;s:26:\product_name=Madhatter_Hat\;i:4;s:8:\cd_num=2\;i:5;s:4:\x=39\;i:6;s:4:\y=12\;}

the data I want is



MadhatterSize=Adult,MadHatterColors=blue,MadHatter_Qty=1,product_name=Madhatter_Hat

I have tried :  syntax is spliti(regexp patter,str,max split)
  spliti(:,$my_Propellar_Data,15);

the above is the only regexp that works so far , but doesnt come close
to matching what I want.

$_ = 
q(a:7:{i:0;s:19:MadhatterSize=Adult;i:1;s:20:MadHatterColors=blue;i:2;s:15:MadHatter_Qty=1;i:3;s:26:product_name=Madhatter_Hat;i:4;s:8:cd_num=2;i:5;s:4:x=39;i:6;s:4:\y=12};);

my @args = $_ =~ /(.*?)/g;
print join (',', @args[0..3]), \n;


-- 
  ,-/-  __  _  _ $Bill LuebkertMailto:[EMAIL PROTECTED]
 (_/   /  )// //   DBE CollectiblesMailto:[EMAIL PROTECTED]
  / ) /--  o // //  Castle of Medieval Myth  Magic http://www.todbe.com/
-/-' /___/__/_/_http://dbecoll.tripod.com/ (My Perl/Lakers stuff)

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: reg exp help please

2003-12-07 Thread KGalal
Title: RE: reg exp help please





Hi,


I've written a small regexp that prints out the different values being passed, i hope it helps. Here is the code:


$string = a:7:{i:0;s:19:\MadhatterSize=Adult\;i:1;s:20:\MadHatterColors=blue\;i:2;s:15:\MadHatter_Qty=1\;i:3;s:26:\product_name=Madhatter_Hat\;i:4;s:8:\cd_num=2\;i:5;s:4:\x=39\;i:6;s:4:\y=12\;};


@items = split (/\/, $string );
foreach $i ( @items ) {
 if ( $i =~ /=/ ) {
  print $i\n;
 }
}


-Original Message-
From: lorid [mailto:[EMAIL PROTECTED]]
Sent: Monday, 8 December 2003 10:05 AM
To: perl users
Subject: reg exp help please



Here is the string Im trying to split (its a cookie str)
MadHatter Data:
a:7:{i:0;s:19:\MadhatterSize=Adult\;i:1;s:20:\MadHatterColors=blue\;i:2;s:15:\MadHatter_Qty=1\;i:3;s:26:\product_name=Madhatter_Hat\;i:4;s:8:\cd_num=2\;i:5;s:4:\x=39\;i:6;s:4:\y=12\;}

the data I want is


MadhatterSize=Adult,MadHatterColors=blue,MadHatter_Qty=1,product_name=Madhatter_Hat


I have tried : syntax is spliti(regexp patter,str,max split)
 spliti(:,$my_Propellar_Data,15);


the above is the only regexp that works so far , but doesnt come close
to matching what I want.


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs