Re: question about regex for selecting and copying the result into array.

2007-10-09 Thread Patrik Hasibuan
On Tue, 09 Oct 2007 13:29:53 -0700 "John W. Krahn" <[EMAIL PROTECTED]> wrote: PH>Dear John... > $_ = $kontenurl->gogeturl( $assprm{'kwnya'}, $urlnya, $nohal ); > print $_; > > But why not just: > > print $kontenurl->gogeturl( $assprm{'kwnya'}, $urlnya, $nohal ); PH>Because I want to put the res

Re: question about regex for selecting and copying the result into array.

2007-10-09 Thread John W. Krahn
Patrik Hasibuan wrote: Dear my friends... Hello, I want to take all the strings between "" and "" and put it into array. I do this way but it does not work properly: Put these two lines at the start of your program: use warnings; use strict; $kontenurl=eksekusi->baru(); eksekusi is

question about regex for selecting and copying the result into array.

2007-10-09 Thread Patrik Hasibuan
Dear my friends... I want to take all the strings between "" and "" and put it into array. I do this way but it does not work properly: $kontenurl=eksekusi->baru(); $_=$kontenurl->gogeturl("$assprm{'kwnya'}", "$urlnya", "$nohal"); print "$_"; print ""; print ""; $i=0; while (<>){ @resul

Re: Who can help me to explain the reason? about regex `m' modifier.

2006-11-28 Thread Tom Phoenix
On 11/27/06, flw <[EMAIL PROTECTED]> wrote: $ perl -e '$_="a11\nb22\nc33\n"; print $_, "-"x15, "\n";s/^a.*^b.*/x/m; print' $ perl -e '$_="a11\nb22\nc33\n"; print $_, "-"x15, "\n";s/^a.*^b.*/x\n/ms; print' Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [

Re: Who can help me to explain the reason? about regex `m' modifier.

2006-11-28 Thread Adriano Ferreira
On 11/28/06, flw <[EMAIL PROTECTED]> wrote: Who cabeginnersn help me to explain the reason? $ perl -e '$_="a11\nb22\nc33\n"; print $_, "-"x15, "\n";s/^a.*^b.*/x/m; print' The problem here is that \m allows "^" to match after any newline within the string, but does not change "." which matches

Who can help me to explain the reason? about regex `m' modifier.

2006-11-28 Thread flw
Who cabeginnersn help me to explain the reason? $ perl -e '$_="a11\nb22\nc33\n"; print $_, "-"x15, "\n";s/^a.*^b.*/x/m; print' a11 b22 c33 --- a11 b22 c33 $ perl -e '$_="a11\nb22\nc33\n"; print $_, "-"x15, "\n";s/^a.*\cJ^b.*/x/m; print' a11 b22 c33 --- x c33 $ flw [EMAIL

Re: help about regex matching

2005-11-29 Thread Jeff Pang
oh,I see it finally.Thanks for everyone! 2005/11/29, John W. Krahn <[EMAIL PROTECTED]>: > Jeff Pang wrote: > > yes,John's code work well too.But I still don't know why this code > > can't run correctly: > > > > next unless /(\S+).*(\d+\.\d+\.\d+\.\d+)/s; > > > > When I run it,I get these results:

Re: help about regex matching

2005-11-29 Thread John W. Krahn
Jeff Pang wrote: > yes,John's code work well too.But I still don't know why this code > can't run correctly: > > next unless /(\S+).*(\d+\.\d+\.\d+\.\d+)/s; > > When I run it,I get these results: > > 364 2.168.2.20 > 286.4 2.168.2.21 > 264.4 2.168.2.22 > 138 2.168.2.23 > 562.3 2.16

RE: help about regex matching

2005-11-29 Thread Charles K. Clarkson
Pant, Hridyesh wrote: : Why are u using this. : local $/ = "\n\n"; Because I'm cocky! :) $/ is a special perl variable which is used to define the input record separator. It is set to "\n" as a default. By resetting it to "\n\n", I was able to get two lines at

RE: help about regex matching

2005-11-29 Thread Pant, Hridyesh
Why are u using this. local $/ = "\n\n"; -Original Message- From: Charles K. Clarkson [mailto:[EMAIL PROTECTED] Sent: 29 November 2005 13:43 To: 'Perl Beginners' Subject: RE: help about regex matching Jeff Pang <mailto:[EMAIL PROTECTED]> wrote: : Thanks

Re: help about regex matching

2005-11-29 Thread Jeff Pang
yes,John's code work well too.But I still don't know why this code can't run correctly: next unless /(\S+).*(\d+\.\d+\.\d+\.\d+)/s; When I run it,I get these results: 364 2.168.2.20 286.4 2.168.2.21 264.4 2.168.2.22 138 2.168.2.23 562.3 2.168.2.24 80.72.168.2.25 355 2.168.2

Re: help about regex matching

2005-11-29 Thread John W. Krahn
Jeff Pang wrote: > hi,list, Hello, > I have a file looking as below: > > 356.5 > 192.168.2.20 > > [snip] > > 612 > 192.168.2.31 > > ... > > > I want to get this result: > > 356.5 192.168.2.20 > 283.3 192.168.2.21 > 261.9 192.168.2.22 > ... > > > and,I write this regex for matching: > >

Re: help about regex matching

2005-11-29 Thread Jeff Pang
It's ok now.Thanks very much. 2005/11/29, Charles K. Clarkson <[EMAIL PROTECTED]>: > Jeff Pang wrote: > > : Thanks for Charles.That code can work well,but I still want > : to know how to do it with regex expression. > > use strict; > use warnings; > > local $/ = "\n\n";

RE: help about regex matching

2005-11-29 Thread Charles K. Clarkson
Jeff Pang wrote: : Thanks for Charles.That code can work well,but I still want : to know how to do it with regex expression. use strict; use warnings; local $/ = "\n\n"; while ( ) { chomp; printf "%-5s% 15s\n", /(.+)\n(.+)/; } __END__ HTH, Charles K. Clark

Re: help about regex matching

2005-11-28 Thread Jeff Pang
Thanks for Charles.That code can work well,but I still want to know how to do it with regex expression. 2005/11/29, Charles K. Clarkson <[EMAIL PROTECTED]>: > Jeff Pang wrote: > : I would like to use regex for my destination because the file > : size is large and having

RE: help about regex matching

2005-11-28 Thread Bedanta Bordoloi, Gurgaon
eff Pang [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 29, 2005 11:53 AM To: Perl Beginners Subject: help about regex matching hi,list, I have a file looking as below: 356.5 192.168.2.20 283.3 192.168.2.21 261.9 192.168.2.22 135.9 192.168.2.23 557 192.168.2.24 79.4 192.168.2.25 349 192.1

RE: help about regex matching

2005-11-28 Thread Charles K. Clarkson
Jeff Pang wrote: : I would like to use regex for my destination because the file : size is large and having much lines. An unnecessary regex would slow you down on a large file. HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 No regex needed

Re: help about regex matching

2005-11-28 Thread Jeff Pang
en keep exams... > It keeps the exams first and then teaches the lessons. > > > > -Original Message- > From: Jeff Pang [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 29, 2005 11:53 AM > To: Perl Beginners > Sub

RE: help about regex matching

2005-11-28 Thread Dhanashri Bhate
AM To: Perl Beginners Subject: help about regex matching hi,list, I have a file looking as below: 356.5 192.168.2.20 283.3 192.168.2.21 261.9 192.168.2.22 135.9 192.168.2.23 557 192.168.2.24 79.4 192.168.2.25 349 192.168.2.26 265.1 192.168.2.27 326 192.168.2.28 404 192.168.2.29 331 192.168

help about regex matching

2005-11-28 Thread Jeff Pang
hi,list, I have a file looking as below: 356.5 192.168.2.20 283.3 192.168.2.21 261.9 192.168.2.22 135.9 192.168.2.23 557 192.168.2.24 79.4 192.168.2.25 349 192.168.2.26 265.1 192.168.2.27 326 192.168.2.28 404 192.168.2.29 331 192.168.2.30 612 192.168.2.31 ... I want to get this resu

Re: about regex

2005-11-16 Thread Rafael Morales
Thanks to Elie, Jay and Shawn, all work fine, but I used the Jay solution. What I was using is: #!/usr/bin/perl use strict; use warnings; $/ = ""; my $file = "111505_SystemOut_1.log"; open ( FILE, "<$file" ) || die "El nombre de archivo es incorrecto o no existe\n$!\n"; wh

Re: about regex

2005-11-16 Thread Jay Savage
On 11/16/05, Rafael Morales <[EMAIL PROTECTED]> wrote: > Hi list !!! > > This is my trouble, I have a file with this output: > > [11/14/05 22:52:10:130 GMT] 686b4b72 SystemOut O POST: > https://198.104.159.77/ssldocs/ws/xt_vm_transkods.alia?brand=KO-BR&person_id=14560115&password=teatro&trans_

Re: about regex

2005-11-16 Thread Shawn Corey
Elie De Brauwer wrote: You could for example do that by buffering them. Following example reads from standard input. No that you should replace the regexp by something with more meaning in your context. This application also assumes that there will be at least three lines of input. my $a=; ch

Re: about regex

2005-11-16 Thread Elie De Brauwer
Rafael Morales wrote: Hi list !!! This is my trouble, I have a file with this output: [11/14/05 22:52:10:130 GMT] 686b4b72 SystemOut O POST: https://198.104.159.77/ssldocs/ws/xt_vm_transkods.alia?brand=KO-BR&person_id=14560115&password=teatro&trans_id=2&amount=10&trans_date=2005-11-14 20:

about regex

2005-11-16 Thread Rafael Morales
Hi list !!! This is my trouble, I have a file with this output: [11/14/05 22:52:10:130 GMT] 686b4b72 SystemOut O POST: https://198.104.159.77/ssldocs/ws/xt_vm_transkods.alia?brand=KO-BR&person_id=14560115&password=teatro&trans_id=2&amount=10&trans_date=2005-11-14 20:52:10&trans_log=11320087

Re: newbie question about regex

2004-09-03 Thread David Dorward
On Fri, Sep 03, 2004 at 04:33:43PM +0200, Maurice Lucas wrote: > $ ./count.pl /var/log/file text > this works fine but sometimes the "text" is "foo(bar)" and then my scripts > gives an error. > syntax error near unexpected token `foo(b' That's a shell issue, not a Perl issue. Escape your brackets

Re: newbie question about regex

2004-09-03 Thread Maurice Lucas
Hello, I call my script with the following line $ ./count.pl /var/log/file text this works fine but sometimes the "text" is "foo(bar)" and then my scripts gives an error. syntax error near unexpected token `foo(b' I believe the syntax error is from your shell and you can get around this by quoting

Re: newbie question about regex

2004-09-03 Thread Wiggins d Anconia
> Hello, > > I call my script with the following line > $ ./count.pl /var/log/file text > this works fine but sometimes the "text" is "foo(bar)" and then my scripts > gives an error. > syntax error near unexpected token `foo(b' > I believe the syntax error is from your shell and you can get ar

newbie question about regex

2004-09-03 Thread Maurice Lucas
Hello, I call my script with the following line $ ./count.pl /var/log/file text this works fine but sometimes the "text" is "foo(bar)" and then my scripts gives an error. syntax error near unexpected token `foo(b' Could somebody give me a hint? I'm working on linux My script #!/usr/bin/perl

Re: RegExp Help ! (appended question about regex choice ( [^\"]*)vs. (+*?))

2004-05-11 Thread John W. Krahn
William M West wrote: > > David Dorward wrote: > > > >(my $action) = ($html =~ /action=\"(.*?)\"/); > > > >That gives the same as my example. > > using parentheses to capture matches is really neat :) i > did not know that you could do that. It is not the parentheses per se that capture matche

RE: Help about Regex

2003-01-29 Thread Mark Anderson
5:10 PM To: [EMAIL PROTECTED] Subject: Help about Regex I'm newbie.. Would u help me to explain this regex: =[td]s/$directory/ What is the meaning of [td]???, because there is no metacharacter or regex that use [td]. Thanks for your help.

Help about Regex

2003-01-29 Thread lielie meimei
I'm newbie.. Would u help me to explain this regex: =[td]s/$directory/ What is the meaning of [td]???, because there is no metacharacter or regex that use [td]. Thanks for your help. __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign

Re: question about regex

2002-02-25 Thread Tanton Gibbs
]> Sent: Monday, February 25, 2002 8:07 PM Subject: question about regex > Hi, All: > > I have problem with regex. I try to get some content > from a html source and print it out on the screen. > the following is my code: > > use LWP::Simple qw(get); > my $url = "h

question about regex

2002-02-25 Thread Yuan Cheng
Hi, All: I have problem with regex. I try to get some content from a html source and print it out on the screen. the following is my code: use LWP::Simple qw(get); my $url = "http://www.somewebsite.com";; my $html = get($url); my $index = "some index number"; my @result = $html =~ /.*$index.*(

Re: question about regex back referencing

2001-07-02 Thread Peter Cline
At 04:41 PM 7/2/01 -0400, Jeff 'japhy' Pinyan wrote: >On Jul 2, Peter Cline said: > > >if (/^(.+)_(\d+)$/) { > > $script_info[$2] = { 'id' => $2, } unless { > >defined($script_info[$2]) }; > > $script_info[$2]->{$1} = $q->param("$_"); > > } > > > >and thereby eliminated my

Re: question about regex back referencing

2001-07-02 Thread Jeff 'japhy' Pinyan
On Jul 2, Peter Cline said: >if (/^(.+)_(\d+)$/) { > $script_info[$2] = { 'id' => $2, } unless { >defined($script_info[$2]) }; > $script_info[$2]->{$1} = $q->param("$_"); > } > >and thereby eliminated my problem. Or not. print "foo" unless { 1 }; print "bar" unless

Re: question about regex back referencing

2001-07-02 Thread Peter Cline
It seems that posting to the list is often the catalyst that provides enough activation energy to prompt the revelation that gives me the answer I need. I now see the folly of if (/^(.+)_(\d+)$/) { $script_info[$2] = { 'id' => $2, } $script_info[$2]->{$1} = $q->param("$_");

Question about Regex back referencing

2001-07-02 Thread Peter Cline
Hello all. I am using the following subroutine and it is exhibitng an undesirable behavior that I can't figure out how to change. The array @names consists of elements that alternate between domain_# and product_# with # representing some positive integral value. Also, two subsequent entries