Re: another reg needed

2002-08-20 Thread root

Connie Chan wrote:

> Strange ...
>
> my ($row, $col) = /(\d+)/g;
> Can get the value.
>
> but
> my ($row, $col) =~ /(\d+)/g;
> will get , only.
>
> Why ?
>
> Besides, that's really that mine one on the last post
> doesn't work. but what's the problem ?
>
> Anyway, here is a stupid update for my approach.
>
> my ($row, $col) = ($1, $2) if ( /^[^\d]+(\d+)[^\d]+(\d+)$/);
>
> but of cause :
>
> ($row, $col) = /(\d+)/g ; # is much much better.
>
> Rgds,
> Connie
>
> - Original Message -
> From: "Nikola Janceski" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; "Connie Chan" <[EMAIL PROTECTED]>; "Beginners Perl" 
><[EMAIL PROTECTED]>
> Sent: Saturday, August 17, 2002 4:53 AM
> Subject: RE: another reg needed
>
> > probably what you wanted is:
> >
> > ($row, $col) = /(\d+)/g;
> >
> > > -Original Message-
> > > From: Jerry Preston [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, August 16, 2002 4:49 PM
> > > To: Connie Chan; Beginners Perl
> > > Subject: RE: another reg needed
> > >
> > >
> > > Connie,
> > >
> > > This is what I am looking for!  But all I get is','.
> > >
> > > Thanks,
> > >
> > > Jerry
> > >
> > > -Original Message-
> > > From: Connie Chan [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, August 16, 2002 3:34 PM
> > > To: [EMAIL PROTECTED]; Beginners Perl
> > > Subject: Re: another reg needed
> > >
> > >
> > > > $_ = "Die,Row 0, Column 12"
> > >
> > > do you trying to get this ?
> > >
> > > my ($row, $col) = ($1, $2) =~ m/^.+(\d+).+(\d+)$/;
> > > # $row = 0;
> > > # $col = 12;
> > >
> > > /^ means beginning of line
> > > ..+ means anything
> > > \d+ means 1 more more digit numbers
> > > (xxx) capture matched values within blankets in order to $1, $2...$x.
> > > $/ means the end of the line.
> > >
> > > >
> > > > What I want is the 0 and 12.  What about the text?
> > > >
> > >
> > > So what do you want to deal with the text ?
> > >
> > > Rgds,
> > > Connie
> > >
> > >
> > > --
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> >
> > 
> > 
> > The views and opinions expressed in this email message are the sender's
> > own, and do not necessarily represent the views and opinions of Summit
> > Systems Inc.
> >
> >

your version:

($row, $col) =~ /(\d+)/g;

means:

1. turn ($row, $col) into a scalar which is a nubmer of element of the array which is 2
2. and then turn the numeric number 2 into a string which is "2"
3. and then search the string "2" for /(\d+)/g which will never success

remove the '~' characeter and the reg. expression is searched on the $_ variable and 
it will then
success

david


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: another reg needed

2002-08-18 Thread Dharmendra Rai


well i think the following is general

@my_array = /(\d+)/g ; # is much much better.

thanx





-
Get a bigger mailbox -- choose a size that fits your needs.

http://uk.docs.yahoo.com/mail_storage.html


Re: another reg needed

2002-08-17 Thread drieux


On Friday, August 16, 2002, at 02:20 , Nikola Janceski wrote:
[..]

Nikola - thank you for working the space
but I fear that this is one of those

well it works

> this is right:
> ($row, $col) = /(\d+)/g;
>

I know that the OP had proposed

$_ = "some stuff here"

but I think that it would be more useful in the
long run to do the additional typing with say


my ($row, $col) = $string =~ /(\d+)/g

so that it is a bit clearer what we were planning on doing.

ciao
drieux


some play code to work the idea

my $string = "die 2, wold 4 bob: 6";

my @list = $string =~ /(\d+)/g ;

print "the \@list says: @list \n";
print "$_ \n" for @list;

print "#---\n";

$_ =$string ;

my ($val1, $val2 ) =  /(\d+)/g ;

my $tmp = $_;

print "$tmp has value \n" if ( $tmp );

print "Given:\n\t - $string \n\t - have <$val1> and <$val2>\n";


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: another reg needed

2002-08-16 Thread Nikola Janceski

soorry.. long week.
Brain malfunction, shouldn't have ~
you aren't doing a bitwise, you want the assignment.

this is right:
($row, $col) = /(\d+)/g;

> -Original Message-
> From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 16, 2002 4:56 PM
> To: Nikola Janceski; '[EMAIL PROTECTED]'; Connie Chan; Beginners Perl
> Subject: RE: another reg needed
> 
> 
> doh... forgot the ~
> 
> ($row, $col) =~ /(\d+)/g;
> 
> > -Original Message-
> > From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, August 16, 2002 4:54 PM
> > To: '[EMAIL PROTECTED]'; Connie Chan; Beginners Perl
> > Subject: RE: another reg needed
> > 
> > 
> > probably what you wanted is:
> > 
> > ($row, $col) = /(\d+)/g;
> > 
> 
> --
> --
> 
> The views and opinions expressed in this email message are 
> the sender's
> own, and do not necessarily represent the views and opinions of Summit
> Systems Inc.
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 



The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: another reg needed

2002-08-16 Thread Connie Chan

Strange ...

my ($row, $col) = /(\d+)/g;
Can get the value. 

but
my ($row, $col) =~ /(\d+)/g;
will get , only. 

Why ?

Besides, that's really that mine one on the last post 
doesn't work. but what's the problem ?

Anyway, here is a stupid update for my approach.

my ($row, $col) = ($1, $2) if ( /^[^\d]+(\d+)[^\d]+(\d+)$/);

but of cause :

($row, $col) = /(\d+)/g ; # is much much better.

Rgds,
Connie


- Original Message - 
From: "Nikola Janceski" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "Connie Chan" <[EMAIL PROTECTED]>; "Beginners Perl" 
<[EMAIL PROTECTED]>
Sent: Saturday, August 17, 2002 4:53 AM
Subject: RE: another reg needed


> probably what you wanted is:
> 
> ($row, $col) = /(\d+)/g;
> 
> > -Original Message-
> > From: Jerry Preston [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, August 16, 2002 4:49 PM
> > To: Connie Chan; Beginners Perl
> > Subject: RE: another reg needed
> > 
> > 
> > Connie,
> > 
> > This is what I am looking for!  But all I get is','.
> > 
> > Thanks,
> > 
> > Jerry
> > 
> > -----Original Message-
> > From: Connie Chan [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, August 16, 2002 3:34 PM
> > To: [EMAIL PROTECTED]; Beginners Perl
> > Subject: Re: another reg needed
> > 
> > 
> > > $_ = "Die,Row 0, Column 12"
> > 
> > do you trying to get this ?
> > 
> > my ($row, $col) = ($1, $2) =~ m/^.+(\d+).+(\d+)$/;
> > # $row = 0;
> > # $col = 12;
> > 
> > /^ means beginning of line
> > ..+ means anything
> > \d+ means 1 more more digit numbers
> > (xxx) capture matched values within blankets in order to $1, $2...$x.
> > $/ means the end of the line.
> > 
> > > 
> > > What I want is the 0 and 12.  What about the text?
> > > 
> > 
> > So what do you want to deal with the text ? 
> > 
> > Rgds,
> > Connie
> > 
> > 
> > -- 
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> 
> 
> The views and opinions expressed in this email message are the sender's
> own, and do not necessarily represent the views and opinions of Summit
> Systems Inc.
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: another reg needed

2002-08-16 Thread Nikola Janceski

doh... forgot the ~

($row, $col) =~ /(\d+)/g;

> -Original Message-
> From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 16, 2002 4:54 PM
> To: '[EMAIL PROTECTED]'; Connie Chan; Beginners Perl
> Subject: RE: another reg needed
> 
> 
> probably what you wanted is:
> 
> ($row, $col) = /(\d+)/g;
> 



The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: another reg needed

2002-08-16 Thread Nikola Janceski

probably what you wanted is:

($row, $col) = /(\d+)/g;

> -Original Message-
> From: Jerry Preston [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 16, 2002 4:49 PM
> To: Connie Chan; Beginners Perl
> Subject: RE: another reg needed
> 
> 
> Connie,
> 
> This is what I am looking for!  But all I get is','.
> 
> Thanks,
> 
> Jerry
> 
> -Original Message-
> From: Connie Chan [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 16, 2002 3:34 PM
> To: [EMAIL PROTECTED]; Beginners Perl
> Subject: Re: another reg needed
> 
> 
> > $_ = "Die,Row 0, Column 12"
> 
> do you trying to get this ?
> 
> my ($row, $col) = ($1, $2) =~ m/^.+(\d+).+(\d+)$/;
> # $row = 0;
> # $col = 12;
> 
> /^ means beginning of line
> ..+ means anything
> \d+ means 1 more more digit numbers
> (xxx) capture matched values within blankets in order to $1, $2...$x.
> $/ means the end of the line.
> 
> > 
> > What I want is the 0 and 12.  What about the text?
> > 
> 
> So what do you want to deal with the text ? 
> 
> Rgds,
> Connie
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 



The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: another reg needed

2002-08-16 Thread Bob Showalter

> -Original Message-
> From: Jerry Preston [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 16, 2002 4:19 PM
> To: Beginners Perl
> Subject: another reg needed
> 
> 
> Hi,
> 
> I am trying to learn to do  reg's and I am not sure how to 
> break this down:
> 
> $_ = "Die,Row 0, Column 12"
> 
> What I want is the 0 and 12.  What about the text?

How about:

   ($row, $col) = /(\d+)/g;

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: another reg needed

2002-08-16 Thread Jerry Preston

Connie,

This is what I am looking for!  But all I get is','.

Thanks,

Jerry

-Original Message-
From: Connie Chan [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 16, 2002 3:34 PM
To: [EMAIL PROTECTED]; Beginners Perl
Subject: Re: another reg needed


> $_ = "Die,Row 0, Column 12"

do you trying to get this ?

my ($row, $col) = ($1, $2) =~ m/^.+(\d+).+(\d+)$/;
# $row = 0;
# $col = 12;

/^ means beginning of line
..+ means anything
\d+ means 1 more more digit numbers
(xxx) capture matched values within blankets in order to $1, $2...$x.
$/ means the end of the line.

> 
> What I want is the 0 and 12.  What about the text?
> 

So what do you want to deal with the text ? 

Rgds,
Connie


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: another reg needed

2002-08-16 Thread Connie Chan

> $_ = "Die,Row 0, Column 12"

do you trying to get this ?

my ($row, $col) = ($1, $2) =~ m/^.+(\d+).+(\d+)$/;
# $row = 0;
# $col = 12;

/^ means beginning of line
..+ means anything
\d+ means 1 more more digit numbers
(xxx) capture matched values within blankets in order to $1, $2...$x.
$/ means the end of the line.

> 
> What I want is the 0 and 12.  What about the text?
> 

So what do you want to deal with the text ? 

Rgds,
Connie


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: another reg needed

2002-08-16 Thread Mark Anderson

Do you want them in two separate variables, or in a list?

Are you looking for just this one case, or a more general case?

/\/\ark

-Original Message-
From: Jerry Preston [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 16, 2002 1:19 PM
To: Beginners Perl
Subject: another reg needed


Hi,

I am trying to learn to do  reg's and I am not sure how to break this down:

$_ = "Die,Row 0, Column 12"

What I want is the 0 and 12.  What about the text?

Thanks,

Jerry

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]