Re: help in regular expression

2011-09-11 Thread Uri Guttman
ta == timothy adigun 2teezp...@gmail.com writes: ta You can use unpack: ta$val = 11.0.56.1; ta$new_val=unpack(x5 A2,$val); # skip forward 6, get 2 ta print $new_val # print 56; unpack would be a poor choice if the number of digits in a field changes. pack/unpack are

Re: help in regular expression

2011-09-11 Thread timothy adigun
ug == Uri Guttman u...@stemsystems.com writes: ug unpack would be a poor choice if the number of digits in a field ug changes. pack/unpack are meant for use in fixed field records. That was a bad assumption on my side, I only considered the problem at hand, thinking unpack will be faster

Re: help in regular expression

2011-09-10 Thread Shlomi Fish
Hi Irfan, On Sat, 10 Sep 2011 10:23:31 -0700 (PDT) Irfan Sayed irfan_sayed2...@yahoo.com wrote: hi, i have following string. $val = 11.0.56.1; i need to write regular expression which should match only 56 and print There are any number of ways to extract 56 using a regular

Re: help in regular expression

2011-09-10 Thread Shawn H Corey
On 11-09-10 01:23 PM, Irfan Sayed wrote: i have following string. $val = 11.0.56.1; i need to write regular expression which should match only 56 and print please suggest ( $val =~ /(56)/ ) print $1; -- Just my 0.0002 million dollars worth, Shawn Confusion is the first step of

Re: help in regular expression

2011-09-10 Thread Rob Dixon
On 10/09/2011 18:23, Irfan Sayed wrote: hi, i have following string. $val = 11.0.56.1; i need to write regular expression which should match only 56 and print please suggest I think you should forget about regular expressions and use split: my $sub = (split /\./, $val)[2]; HTH,

Re: help in regular expression

2011-09-10 Thread timothy adigun
Hi Irfan, You can use unpack: $val = 11.0.56.1; $new_val=unpack(x5 A2,$val); # skip forward 6, get 2 print $new_val # print 56;

Re: Help on regular expression !!

2009-08-03 Thread John W. Krahn
jet speed wrote: Guys, Hello, I am new to perl, I am having trouble capturing the required output from the command, with my limited knowlege i tried to put something togather. not sure how to proceed beyond. In a regular expression, when you want to capture part of a pattern you have to

Re: Help on regular expression !!

2009-08-03 Thread jet speed
On Mon, Aug 3, 2009 at 4:00 PM, John W. Krahn jwkr...@shaw.ca wrote: jet speed wrote: Guys, Hello, I am new to perl, I am having trouble capturing the required output from the command, with my limited knowlege i tried to put something togather. not sure how to proceed beyond. In a

Re: Help on regular expression !!

2009-08-03 Thread John W. Krahn
jet speed wrote: Hi John, Thanks for your help, Much appreciated. Please could you also refer any good reference for Regular expression for a beginer like me, would be great. Have you read the documentation that comes with Perl? perldoc perlrequick perldoc perlretut perldoc perlre John

Re: Help on regular expression !!

2009-08-03 Thread jet speed
On Mon, Aug 3, 2009 at 5:45 PM, John W. Krahn jwkr...@shaw.ca wrote: jet speed wrote: Hi John, Thanks for your help, Much appreciated. Please could you also refer any good reference for Regular expression for a beginer like me, would be great. Have you read the documentation that comes

Re: Help on regular expression !!

2009-08-03 Thread John W. Krahn
jet speed wrote: On Mon, Aug 3, 2009 at 5:45 PM, John W. Krahn jwkr...@shaw.ca wrote: jet speed wrote: Hi John, Thanks for your help, Much appreciated. Please could you also refer any good reference for Regular expression for a beginer like me, would be great. Have you read the

Re: Help on regular expression

2007-12-13 Thread jeff pang
--- Sayed, Irfan (Irfan) [EMAIL PROTECTED] wrote: Hi All, I have a string like this CLEARCASE_CMDLINE = (mkact -nc notme sprint) Now with the regular expression what I want is only those characters before closing braces excluding white space character. I mean to say that if regular

Re: Help on regular expression

2007-12-13 Thread Chas. Owens
On Dec 13, 2007 6:12 AM, Sayed, Irfan (Irfan) [EMAIL PROTECTED] wrote: Hi All, I have a string like this CLEARCASE_CMDLINE = (mkact -nc notme sprint) Now with the regular expression what I want is only those characters before closing braces excluding white space character. I mean to say

Re: Help on regular expression

2007-12-13 Thread Rob Dixon
Sayed, Irfan (Irfan) wrote: Hi All, I have a string like this CLEARCASE_CMDLINE = (mkact -nc notme sprint) Now with the regular expression what I want is only those characters before closing braces excluding white space character. I mean to say that if regular expression encounter the

RE: Help on regular expression

2007-12-13 Thread Sayed, Irfan (Irfan)
To: beginners@perl.org Perl Beginners Cc: Sayed, Irfan (Irfan) Subject: Re: Help on regular expression Sayed, Irfan (Irfan) wrote: Hi All, I have a string like this CLEARCASE_CMDLINE = (mkact -nc notme sprint) Now with the regular expression what I want is only those characters before closing

Re: Help on regular expression

2007-12-13 Thread Rob Dixon
Sayed, Irfan (Irfan) wrote: From: Rob Dixon [mailto:[EMAIL PROTECTED] Sayed, Irfan (Irfan) wrote: Hi All, I have a string like this CLEARCASE_CMDLINE = (mkact -nc notme sprint) Now with the regular expression what I want is only those characters before closing braces excluding white

Re: help in regular expression

2006-06-01 Thread John W. Krahn
Irfan J Sayed wrote: Hi , Hello, I am using following code #!/usr/local/bin/perl # Main program use warnings; use strict; my $file = c:\backup.pl; The escape sequence \b represents the backspace character. You probably want: my $file = 'c:/backup.pl'; open(FH,$file) ||

Re: help in regular expression

2006-06-01 Thread David Romano
Hi Irfan, On 6/1/06, Irfan J Sayed [EMAIL PROTECTED] wrote: Hi , I am using following code #!/usr/local/bin/perl # Main program use warnings; use strict; my $file = c:\backup.pl; open(FH,$file) || die can't open a file; my $pattern = '\w\s\w'; my $input = ; print yes got the match

interpolation problems (was: Re: help in regular expression)

2006-06-01 Thread Dr.Ruud
Irfan J Sayed schreef: #!/usr/local/bin/perl use warnings; use strict; Good! my $file = c:\backup.pl; Use my $file = 'c:\backup.pl'; or rather my $file = 'c:/backup.pl'; open(FH,$file) || die can't open a file; Make that: open my $fh, '', $file or die Error opening

Re: help in regular expression

2006-06-01 Thread Muma W.
Irfan J Sayed wrote: Hi , I am using following code #!/usr/local/bin/perl # Main program use warnings; use strict; my $file = c:\backup.pl; open(FH,$file) || die can't open a file; [...] For the die statement, use this instead: die can't open this file: $file reason: $!; Your

Re: help in regular expression

2006-06-01 Thread Dr.Ruud
David Romano schreef: [ $pattern = '\w\s\w' ] You also need to [...] escape the slashes for the pattern you're using I don't think that is needed: (1) perl -le '$re = q{\w\s\w} ; print qr/$re/' (2) perl -le '$re = q{\\w\\s\\w} ; print qr/$re/' (on Windows you'll need to change the outer

Re: help in regular expression

2006-06-01 Thread David Romano
Hi Ruud, On 6/1/06, Dr.Ruud [EMAIL PROTECTED] wrote: David Romano schreef: [ $pattern = '\w\s\w' ] You also need to [...] escape the slashes for the pattern you're using I don't think that is needed: (1) perl -le '$re = q{\w\s\w} ; print qr/$re/' (2) perl -le '$re = q{\\w\\s\\w} ;

Re: help on regular expression

2004-01-28 Thread Rob Dixon
Madhu Reddy wrote: Hi, I need some help on regular expression... i have following in variable $total_count $total_count = ##I USBP 01 10:38:09(000) xyz_abc_etrack_validation,6 ETRACK_TOTAL_RECS : 100 Here in this ETRACK_TOTAL_RECS is fixed and common for all and rest is

RE: help on regular expression

2004-01-28 Thread Mark Anderson
Hi, I need some help on regular expression... i have following in variable $total_count $total_count = ##I USBP 01 10:38:09(000) xyz_abc_etrack_validation,6 ETRACK_TOTAL_RECS : 100 Here in this ETRACK_TOTAL_RECS is fixed and common for all and rest is changing... like following

Re: help on regular expression

2004-01-28 Thread Kenton Brede
On Tue, Jan 27, 2004 at 07:49:02AM -0800, Madhu Reddy ([EMAIL PROTECTED]) wrote: Hi, I need some help on regular expression... i have following in variable $total_count $total_count = ##I USBP 01 10:38:09(000) xyz_abc_etrack_validation,6 ETRACK_TOTAL_RECS : 100 Here in this

Re: help on regular expression

2004-01-28 Thread Jan Eden
Hi, $total_count =~ s/.+ : (\d+)/$1/; HTH, Jan Madhu Reddy wrote: Hi, I need some help on regular expression... i have following in variable $total_count $total_count = ##I USBP 01 10:38:09(000) xyz_abc_etrack_validation,6 ETRACK_TOTAL_RECS : 100 Here in this ETRACK_TOTAL_RECS is

Re: help on regular expression

2004-01-28 Thread John McKown
On Tue, 27 Jan 2004, Madhu Reddy wrote: Hi, I need some help on regular expression... i have following in variable $total_count $total_count = ##I USBP 01 10:38:09(000) xyz_abc_etrack_validation,6 ETRACK_TOTAL_RECS : 100 Here in this ETRACK_TOTAL_RECS is fixed and common for all

Re: Help with regular expression

2002-09-26 Thread ANIDIL RAJENDRAN
Try this if you want regex. This may not be the appropriate but works. @list = ('1992','1993 (summer)','1995 fall'); foreach (@list) { push @array, $1 if $_ =~ /(\d+)\s*.*$/; } print map {$_,\n} @array; regards Rajendran Burlingame,CA - Original Message - From: Shaun Bramley

RE: Help with regular expression

2002-09-25 Thread Shishir K. Singh
Nope..this won't work. Why don't you loop over the list and do a substring or pack as you know that you need to keep only the first 4 characters of each element? -Original Message- From: Shaun Bramley [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 25, 2002 4:24 PM To: [EMAIL

RE: Help with regular expression

2002-09-25 Thread Bob Showalter
-Original Message- From: Shaun Bramley [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 25, 2002 4:24 PM To: [EMAIL PROTECTED] Subject: Help with regular expression Hi all, I'm just looking for some confirmation on my regx. I have a list ('1992', '1993 (summer)',

Re: Help with regular expression

2002-09-25 Thread david
Shaun Bramley wrote: Hi all, I'm just looking for some confirmation on my regx. I have a list ('1992', '1993 (summer)', '1995 fall') and what I want to do is keep only the first four characters. Will the regx work for me? @list =~ s/\s*//; Again will that turn the list into (1992,

Re: Help with regular expression

2002-09-25 Thread Janek Schleicher
Shaun Bramley wrote at Wed, 25 Sep 2002 22:24:00 +0200: I'm just looking for some confirmation on my regx. I have a list ('1992', '1993 (summer)', '1995 fall') and what I want to do is keep only the first four characters. Will the regx work for me? @list =~ s/\s*//; Again will that

Re: Help in Regular expression with array

2002-06-05 Thread Eric Beaudoin
At 15:49 2002.06.05, Ankit Gupta wrote: Hello, I am facing a problem in using regular expression on array. My code is written below: open(FILE, $dirvalue) ; my @lines = FILE; print @lines; # prints the file contents if( @lines =~ m/Date:/) { print

RE: Help in Regular expression with array

2002-06-05 Thread Bob Showalter
-Original Message- From: Ankit Gupta [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 05, 2002 3:49 PM To: [EMAIL PROTECTED] Subject: Help in Regular expression with array Hello, I am facing a problem in using regular expression on array. My code is written below:

RE: Help in Regular expression with array

2002-06-05 Thread Beau E. Cox
Hi - I don't think you can regex on a whole array; try this after you have loaded the array: for (@lines) {print ok if /Date:/; } This iterates the array lines presenting $_ for each iteration. The regex /Date:/ operates on $_. Aloha = Beau. -Original Message- From:

RE: Help in Regular expression with array

2002-06-05 Thread Shishir K. Singh
Don't know if you can do a search on an array (until and unless you want to evaluate each element) In case you are trying to achieve the multiple lines search, maybe this or the 2nd example can help : open (FILE , $ARGV[0]); my @lines = FILE; close(FILE); $line = join( , @lines);

RE: Help in Regular expression with array

2002-06-05 Thread Eric Beaudoin
At 16:12 2002.06.05, Shishir K. Singh wrote: open (FILE , $ARGV[0]); print ok if ( map { /Date:/ } (FILE) ); close FILE; map return an array with the result of the express apply to each line. Even if none of the lines in FILE contain Date:, you will have an array with one value for each

RE: Help in Regular expression with array

2002-06-05 Thread Shishir K. Singh
!! -Original Message- From: Eric Beaudoin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 05, 2002 4:29 PM To: Shishir K. Singh Cc: Ankit Gupta; [EMAIL PROTECTED] Subject: RE: Help in Regular expression with array At 16:12 2002.06.05, Shishir K. Singh wrote: open (FILE , $ARGV[0]); print ok

RE: Help in Regular expression with array

2002-06-05 Thread Timothy Johnson
] Subject: RE: Help in Regular expression with array Beau..I guess , the evaluation of the expression is not going to be true if no Date: is found. Since map returns a list consisting of the results of each successive evaluation of the expression..., the map will return undef. Although, here..I

RE: help in regular expression

2002-05-31 Thread Shishir K. Singh
You forgot to add g (global)in the end... $dirstruct =~ s/([\W])/-/g; Cheers Shishir -Original Message- From: Ankit Gupta [mailto:[EMAIL PROTECTED]] Sent: Friday, May 31, 2002 10:53 AM To: [EMAIL PROTECTED] Subject: help in regular expression Hello Friends, I need help in the below

Re: help in regular expression

2002-05-31 Thread Jeff 'japhy' Pinyan
On May 31, Ankit Gupta said: $dirstruct =~ s/([\W])/-/; You're missing the /g modifier. And s/([\W])/-/g could be written as s/\W/-/g and would be a bit more efficient. -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734

RE: Help with regular expression.

2001-10-04 Thread Gibbs Tanton - tgibbs
You are looking for the word addr: followed by four groups of digits, three of which are separated by a dot. Therefore you want $string =~ /addr:(\d+\.\d+.\d+\.\d+)/; Now, $1 has the correct ip address. -Original Message- From: Daniel Falkenberg To: [EMAIL PROTECTED] Sent: 10/4/2001