Re: Reg Exp after newline

2012-01-22 Thread John W. Krahn
Lívio Cipriano wrote: Hi, Hello, It's possible to build in Perl a Regular Expression to grab a pattern that extends by two lines ? Yes it is. I want to read a file and know if it's a email message or not, fetching the first Message-Id found. The problem is that some email clients put the

Reg Exp after newline

2012-01-22 Thread Lívio Cipriano
Hi, It's possible to build in Perl a Regular Expression to grab a pattern that extends by two lines ? I want to read a file and know if it's a email message or not, fetching the first Message-Id found. The problem is that some email clients put the Message-Id tag in one line, like this Messa

Re: reg exp

2011-05-31 Thread Chris Nehren
On Wed, May 25, 2011 at 07:39:28 -0700 , Irfan Sayed wrote: > hi, > > i have string like this > "2011/05/25 07:24:58 -0700 PDT"  i need to match "2011/05/25" > i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$ but it is not working > > code is like this > > > $lin = "2011/05/25 07:24:58 -0700 P

Re: reg exp

2011-05-25 Thread Dr.Ruud
On 2011-05-25 16:39, Irfan Sayed wrote: i have string like this "2011/05/25 07:24:58 -0700 PDT" i need to match "2011/05/25" i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$ but it is not working code is like this $lin = "2011/05/25 07:24:58 -0700 PDT"; $lin =~ m/^\d\d\d\d//\d\d/\d\d$/; print

Re: reg exp

2011-05-25 Thread Jim Gibson
At 8:11 AM +0530 5/26/11, Abhinav Kukreja wrote: hi, suppose i have a string that contains n number of date patterns in the string. "2011/05/25 07:24:58 -0700 PDT 2011/04/28 2023/23/45" how can i extract all such patterns. Use a regular expression that matches just those string

Re: reg exp

2011-05-25 Thread Abhinav Kukreja
hi, suppose i have a string that contains n number of date patterns in the string. "2011/05/25 07:24:58 -0700 PDT 2011/04/28 2023/23/45" how can i extract all such patterns. On Wed, May 25, 2011 at 10:08 PM, Rob Dixon wrote: > On 25/05/2011 15:39, Irfan Sayed wrote: > > hi, > >

Re: reg exp

2011-05-25 Thread Rob Dixon
On 25/05/2011 15:39, Irfan Sayed wrote: > hi, > > i have string like this > "2011/05/25 07:24:58 -0700 PDT" i need to match "2011/05/25" > i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$ but it is not working > > code is like this > > > $lin = "2011/05/25 07:24:58 -0700 PDT"; > $lin =~ m/^\d\d

Re: reg exp

2011-05-25 Thread Shawn H Corey
On 11-05-25 10:39 AM, Irfan Sayed wrote: hi, i have string like this "2011/05/25 07:24:58 -0700 PDT" i need to match "2011/05/25" i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$ but it is not working code is like this $lin = "2011/05/25 07:24:58 -0700 PDT"; $lin =~ m/^\d\d\d\d//\d\d/\d\d$/;

Re: reg exp

2011-05-25 Thread Jim Gibson
At 7:39 AM -0700 5/25/11, Irfan Sayed wrote: hi, i have string like this "2011/05/25 07:24:58 -0700 PDT" i need to match "2011/05/25" i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$ but it is not working code is like this $lin = "2011/05/25 07:24:58 -0700 PDT"; $lin =~ m/^\d\d\d\d//\d\

Re: reg exp

2011-05-25 Thread Irfan Sayed
thanks it worked From: Marco van Kammen To: Irfan Sayed ; Perl Beginners Sent: Wednesday, May 25, 2011 8:22 PM Subject: RE: reg exp Surely not perfect but this seems to work... $lin = "2011/05/25 07:24:58 -0700 PDT"; $lin =~ /(^\d+\/\d+\/\d+).*/;

RE: reg exp

2011-05-25 Thread Marco van Kammen
mirabeau.nl Please consider the environment before printing this email-Original Message- From: Irfan Sayed [mailto:irfan_sayed2...@yahoo.com] Sent: Wednesday, May 25, 2011 4:39 PM To: Perl Beginners Subject: reg exp hi, i have string like this "2011/05/25 07:24:58 -0700 PDT"

reg exp

2011-05-25 Thread Irfan Sayed
hi, i have string like this "2011/05/25 07:24:58 -0700 PDT"  i need to match "2011/05/25" i wrote reg ex like this: ^\d\d\d\d//\d\d/\d\d$ but it is not working code is like this $lin = "2011/05/25 07:24:58 -0700 PDT"; $lin =~ m/^\d\d\d\d//\d\d/\d\d$/; print "$lin\n"; plz suggest

Re: Reg Exp: Extract from last appearance of A to first appearance B

2010-04-27 Thread HolyNoob
Thanks everyone, The solution of John W. Krahn works perfectly :) Incredible On Tue, Apr 27, 2010 at 1:41 PM, John W. Krahn wrote: > HolyNoob wrote: > >> Hi, >> > > Hello, > > > I'm trying to make a regexp to match the last appearance of a word (lets >> say >> 'abc') until the first appearance

Re: Reg Exp: Extract from last appearance of A to first appearance B

2010-04-27 Thread John W. Krahn
HolyNoob wrote: Hi, Hello, I'm trying to make a regexp to match the last appearance of a word (lets say 'abc') until the first appearance of another word (for ex: 'xyz'), and I still cannot do it. For example: with a string like this "abc abc abc toto toto xyz xyz xyz" , which regexp I have

Re: Reg Exp: Extract from last appearance of A to first appearance B

2010-04-27 Thread Erez Schatz
All this and more is available at http://perldoc.perl.org/perlre.html On 27 April 2010 12:39, Erez Schatz wrote: > You need to specify that the string you look for should not appear in > the part you try to extract, meaning instead of .*? you should be > looking for (not abc)*? In perl, we have t

Re: Reg Exp: Extract from last appearance of A to first appearance B

2010-04-27 Thread Erez Schatz
You need to specify that the string you look for should not appear in the part you try to extract, meaning instead of .*? you should be looking for (not abc)*? In perl, we have the negative lookahed for that: (?!...): m/abc((.(?!abc))*?)xyz/ However, this would fail if you have a string abc abcabc

Reg Exp: Extract from last appearance of A to first appearance B

2010-04-27 Thread HolyNoob
Hi, I'm trying to make a regexp to match the last appearance of a word (lets say 'abc') until the first appearance of another word (for ex: 'xyz'), and I still cannot do it. For example: with a string like this "abc abc abc toto toto xyz xyz xyz" , which regexp I have to use to get "abc toto toto

Re: reg exp question

2009-07-15 Thread John W. Krahn
Lex Thoonen wrote: Hi, I'm trying to do this: in the original text is this: ((se-HomePage|Svenska)) I want to leave it at just: Svenska So I tried this: $row[3] =~ s|\(\(.*?\|(.*?)\)\)|$1|g; but somehow after substituting it now shows: ((se-HomePage|Svenska I don't get it. $ perl -le

Re: reg exp question

2009-07-15 Thread Steve Bertrand
Lex Thoonen wrote: > Hi, > > I'm trying to do this: > > in the original text is this: > > ((se-HomePage|Svenska)) > > I want to leave it at just: > > Svenska > > So I tried this: > > $row[3] =~ s|\(\(.*?\|(.*?)\)\)|$1|g; > > but somehow after substituting it now shows: > > ((se-HomePage|Sv

reg exp question

2009-07-15 Thread Lex Thoonen
Hi, I'm trying to do this: in the original text is this: ((se-HomePage|Svenska)) I want to leave it at just: Svenska So I tried this: $row[3] =~ s|\(\(.*?\|(.*?)\)\)|$1|g; but somehow after substituting it now shows: ((se-HomePage|Svenska I don't get it. Someone here? Thanks! -- Lex

Re: perl reg. exp. (search and replace)

2008-11-03 Thread Anirban Adhikary
use strict; use warnings; my $string="fsdfsdfsdf fsdfsdfsdf"; my ($a,$b)=split(/\s+/,$string); my $new_string=$a."_".$b; print $new_string."\n"; Regards Anirban Adhikary. On Mon, Nov 3, 2008 at 2:15 PM, John W. Krahn <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >> Hi all, >> > > Hell

Re: perl reg. exp. (search and replace)

2008-11-03 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hi all, Hello, I have a string which contains spaces. I need to replace those spaces with underscore, so I have written command like this $string="fsdfsdfsdf fsdfsdfsdf"; chomp($string1 = ($string =~ s/\s+$/_/g)); \s+$ matches one or more of any whitespace characte

perl reg. exp. (search and replace)

2008-11-02 Thread Irfan.Sayed
Hi all, I have a string which contains spaces. I need to replace those spaces with underscore, so I have written command like this $string="fsdfsdfsdf fsdfsdfsdf"; chomp($string1 = ($string =~ s/\s+$/_/g)); print "$string1\n"; but still $string1 is not printing proper result. Result sho

Re: Regarding reg. exp.

2008-10-14 Thread Dr.Ruud
[EMAIL PROTECTED] schreef: > if ($trig_np =~ m/\d,{1}\d|\d\s{1}\d/) As long as you understand that "\s" matches SPC, TAB, CR, NL and several other characters, and "\d" matches [0-9] and many other characters, and how one day that will bite you, feel free to use "\s" and "\d". (I would use neithe

RE: Regarding reg. exp.

2008-10-14 Thread Irfan.Sayed
Thanks really -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 14, 2008 6:31 PM To: Perl Beginners Cc: Sayed, Irfan (Cognizant) Subject: Re: Regarding reg. exp. [EMAIL PROTECTED] wrote: > From: Rob Dixon [mailto:[EMAIL PROTECTED] >> [EMAIL

Re: Regarding reg. exp.

2008-10-14 Thread Rob Dixon
r. I need all users to adhere that and if >>> they not then they should exit. >>> >>> Can somebody please give me reg. exp. which can be used to parse the >>> string and check whether comma OR space is there or not as a delimiter >>> and it should contain o

Re: Regarding reg. exp.

2008-10-14 Thread Rob Dixon
Dr.Ruud wrote: > Rob Dixon schreef: > >> my $re = qr/^ >> \d+ >> (?: >>(?:,\d+)* | (?: \d+)* >> ) >> $/x; >> >> chomp (my $input = <>); >> >> if ($input =~ $re) { >> print "ok\n"; >> } >> else { >> print "invalid\n"; >> } > > One problem: the space in "(?: \d+)*" is eaten by the x-m

RE: Regarding reg. exp.

2008-10-14 Thread Irfan.Sayed
But I don’t want to match 12,2, or 234432 53. I want to match whether string contains 1 2 OR 1,2 OR 1,2,3 OR 1 2 3 Or any such combinations. And I think this reg. exp. is doing that job. -Original Message- From: Vyacheslav Karamov [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 14

Re: Regarding reg. exp.

2008-10-14 Thread Vyacheslav Karamov
[EMAIL PROTECTED] пишет: Because I want comma (,) exactly once -Original Message- From: Vyacheslav Karamov [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 14, 2008 4:41 PM To: Sayed, Irfan (Cognizant) Cc: [EMAIL PROTECTED]; beginners@perl.org Subject: Re: Regarding reg. exp. [EMAIL

RE: Regarding reg. exp.

2008-10-14 Thread Irfan.Sayed
Because I want comma (,) exactly once -Original Message- From: Vyacheslav Karamov [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 14, 2008 4:41 PM To: Sayed, Irfan (Cognizant) Cc: [EMAIL PROTECTED]; beginners@perl.org Subject: Re: Regarding reg. exp. [EMAIL PROTECTED] пишет: >

Re: Regarding reg. exp.

2008-10-14 Thread Vyacheslav Karamov
[EMAIL PROTECTED] пишет: if ($trig_np =~ m/\d,{1}\d|\d\s{1}\d/) this what I did. Hi! Why have you used {1} quantifier? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

RE: Regarding reg. exp.

2008-10-14 Thread Irfan.Sayed
if ($trig_np =~ m/\d,{1}\d|\d\s{1}\d/) this what I did. -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Monday, October 13, 2008 6:49 PM To: Perl Beginners Cc: Sayed, Irfan (Cognizant) Subject: Re: Regarding reg. exp. [EMAIL PROTECTED] wrote: > > I have a stri

Re: Regarding reg. exp.

2008-10-13 Thread Dr.Ruud
Rob Dixon schreef: > my $re = qr/^ > \d+ > (?: >(?:,\d+)* | (?: \d+)* > ) > $/x; > > chomp (my $input = <>); > > if ($input =~ $re) { > print "ok\n"; > } > else { > print "invalid\n"; > } One problem: the space in "(?: \d+)*" is eaten by the x-modifier. I would normally use [[:blan

Re: Regarding reg. exp.

2008-10-13 Thread Rob Coops
pt that input should be in the > following format. > > > > For example:- 1,2,3 OR 1 2 3 > > > > Which means that delimiter between these figures should be comma OR > space. No any other character. I need all users to adhere that and if > they not then they should exit.

Re: Regarding reg. exp.

2008-10-13 Thread Rob Dixon
ple:- 1,2,3 OR 1 2 3 > > Which means that delimiter between these figures should be comma OR > space. No any other character. I need all users to adhere that and if > they not then they should exit. > > Can somebody please give me reg. exp. which can be used to parse the >

Re: Regarding reg. exp.

2008-10-13 Thread Dr.Ruud
[EMAIL PROTECTED] schreef: > For example:- 1,2,3 OR 1 2 3 I assume it should also work on 132,45,16 but should it also work on 132, 45, 16 or on 0132,-45,16E0,0x03 etc. ? See Regexp::Common. -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL P

Regarding reg. exp.

2008-10-13 Thread Irfan.Sayed
delimiter between these figures should be comma OR space. No any other character. I need all users to adhere that and if they not then they should exit. Can somebody please give me reg. exp. which can be used to parse the string and check whether comma OR space is there or not as a delimiter and it

Re: help in reg. exp.

2008-04-21 Thread Rob Dixon
[EMAIL PROTECTED] wrote: > > I have string like OMS.FD.08.03.000.0 Now my req. is that if the string > contains .0 at the end then I want to remove that .0 but if any other > digit is there other than .0 then don't do anything. > > For example: if string is : OMS.FD.08.03.000.0 then regular expre

Re: help in reg. exp.

2008-04-21 Thread J. Peng
On Mon, Apr 21, 2008 at 7:17 PM, <[EMAIL PROTECTED]> wrote: > Hi All, > > > > I have string like OMS.FD.08.03.000.0 Now my req. is that if the string > contains .0 at the end then I want to remove that .0 but if any other > digit is there other than .0 then don't do anything. > > > > For examp

Re: help in reg. exp.

2008-04-21 Thread Chas. Owens
On Mon, Apr 21, 2008 at 7:17 AM, <[EMAIL PROTECTED]> wrote: snip > I have string like OMS.FD.08.03.000.0 Now my req. is that if the string > contains .0 at the end then I want to remove that .0 but if any other > digit is there other than .0 then don't do anything. snip What have you tried so

help in reg. exp.

2008-04-21 Thread Irfan.Sayed
Hi All, I have string like OMS.FD.08.03.000.0 Now my req. is that if the string contains .0 at the end then I want to remove that .0 but if any other digit is there other than .0 then don't do anything. For example: if string is : OMS.FD.08.03.000.0 then regular expression should give OMS.F

RE: how to write 0 to 10 in reg exp.

2008-04-02 Thread sanket vaidya
MAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 02, 2008 2:09 PM To: beginners@perl.org Subject: how to write 0 to 10 in reg exp. Hi, How do I write the expression, if the variable match between 0 to 10? Below is the wrong expression I wrote which is suppose to be if $eightdeck

Re: how to write 0 to 10 in reg exp.

2008-04-02 Thread Jeff Pang
try this one: # perl -Mstrict -le 'my $x=shift; print 1 if $x=~/^[0-9]$|^10$/' 10 1 On 4/2/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > How do I write the expression, if the variable match between 0 to 10? Below > is the wrong expression I wrote which is suppose to be if $eightdec

how to write 0 to 10 in reg exp.

2008-04-02 Thread itshardtogetone
Hi, How do I write the expression, if the variable match between 0 to 10? Below is the wrong expression I wrote which is suppose to be if $eightdecks match 0 to 10. So i want the answer to be yes. Thanks my $eightdecks = 6; if($eightdecks =~ /[0-10]/){ print "Yes match\n"; }else{print "no"};

Re: reg exp continued need pulled from reference

2006-12-19 Thread oryann9
oryann9 <[EMAIL PROTECTED]> wrote: Here is my question I have a line of code like so: "$dub_key => $dub_values\n"; that prints dubhpr28.hpux => ARRAY(0x4002e1bc) but I want to have printed out the values contained in the $dub_values arrayref instead of its address. What do I have to c

Re: reg exp continued need pulled from reference

2006-12-19 Thread oryann9
Anyway. When you print $dub_values and it shows up as an array ref as ARRAY(0x4002c164) and you want the values of this arrayref, you have to dereference it in some way. Start with printing out @$dub_values. Or assign it before if you want bigger freedom to format the values: my @[EMAIL PRO

Re: reg exp continued need pulled from reference

2006-12-19 Thread oryann9
"D. Bolliger" <[EMAIL PROTECTED]> wrote:oryann9 am Montag, 18. Dezember 2006 19:52: > "D. Bolliger" wrote: [snipped] > How are my quesitons unclear??? [snipped] I answered offlist. Sorry to all for the noise of this notice. Dani *

Re: reg exp continued need pulled from reference

2006-12-18 Thread D. Bolliger
oryann9 am Montag, 18. Dezember 2006 19:52: > "D. Bolliger" <[EMAIL PROTECTED]> wrote: [snipped] > How are my quesitons unclear??? [snipped] I answered offlist. Sorry to all for the noise of this notice. Dani -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL P

Re: reg exp continued need pulled from reference

2006-12-18 Thread oryann9
"D. Bolliger" <[EMAIL PROTECTED]> wrote: I guess the reason why you got no answer when you posted the identical question in a recent thread is because, at least - your question(s) is/are unclear - your code is not trimmed - even not from comments Anyway. When you print $dub_values and it sho

Re: reg exp continued need pulled from reference

2006-12-18 Thread D. Bolliger
oryann9 am Montag, 18. Dezember 2006 16:55: > Hello... > I have thought about this one and tried various code changes but cannot > get what I want. > > My problem: mismatched UIDs in password files. > My solution: > > #1 store passwd files in a globbed array > #2 create array reference from globb

reg exp continued need pulled from reference

2006-12-18 Thread oryann9
Hello... I have thought about this one and tried various code changes but cannot get what I want. My problem: mismatched UIDs in password files. My solution: #1 store passwd files in a globbed array #2 create array reference from globbed array #3 open array ref, create hash with more than on

Re: reg exp continued need pulled from reference

2006-12-15 Thread oryann9
oryann9 <[EMAIL PROTECTED]> wrote:oryann9 <[EMAIL PROTECTED]> wrote: "Dr.Ruud" wrote: Lawrence Statton XE2/N1GAK schreef: > @{$aref2}[0] is 'sun' ITYM: ${$aref2}[0] is 'sun' -- Affijn, Ruud "Gewoon is een tijger." -- Ok everyone, I have thought about this one and tried various co

Re: reg exp continued need pulled from reference

2006-12-15 Thread oryann9
oryann9 <[EMAIL PROTECTED]> wrote: "Dr.Ruud" wrote: Lawrence Statton XE2/N1GAK schreef: > @{$aref2}[0] is 'sun' ITYM: ${$aref2}[0] is 'sun' -- Affijn, Ruud "Gewoon is een tijger." -- Ok everyone, I have thought about this one and tried various code changes but cannot get what I want

Re: reg exp continued need pulled from reference

2006-12-15 Thread oryann9
"Dr.Ruud" <[EMAIL PROTECTED]> wrote:Lawrence Statton XE2/N1GAK schreef: > @{$aref2}[0] is 'sun' ITYM: ${$aref2}[0] is 'sun' -- Affijn, Ruud "Gewoon is een tijger." -- Ok everyone, I have thought about this one and tried various code changes but cannot get what I want. My

Re: reg exp continued need pulled from reference

2006-12-14 Thread Lawrence Statton XE2/N1GAK
Ahh, good catch -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: reg exp continued need pulled from reference

2006-12-13 Thread Dr.Ruud
Lawrence Statton XE2/N1GAK schreef: > @{$aref2}[0] is 'sun' ITYM: ${$aref2}[0] is 'sun' -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

reg exp continued need pulled from reference

2006-12-13 Thread Derek B. Smith
I want to extend any apologies necessary for my last post. I am not a violent person its just I get annoyed when some people are negative, or to me, are condescending. I was not mad just upset and bothered. No biggy and the past is in the past. : ) -- To unsubscribe, e-mail: [EMAIL PROTECTED] F

RE: reg exp continued need pulled from reference

2006-12-13 Thread Derek B. Smith
--- "Charles K. Clarkson" <[EMAIL PROTECTED]> wrote: > Derek B. Smith > wrote: > > > : I then tried > > Try something simpler, not more complex. Test > this case. > > my @hosts = ( 'sun' ); > $worksheet->write_col( 'A2', [EMAIL PROTECTED], $sheet_format > ); > >

Re: reg exp continued need pulled from reference

2006-12-13 Thread Derek B. Smith
--- Lawrence Statton XE2/N1GAK <[EMAIL PROTECTED]> wrote: > > --- Lawrence Statton XE2/N1GAK > <[EMAIL PROTECTED]> > > I am using Spreadsheet::WriteExcel to populate > certain > > columns which is working, but in column A for > example > > I am using the method write_col which requires a > > refer

Re: reg exp continued need pulled from reference

2006-12-13 Thread Lawrence Statton XE2/N1GAK
> --- Lawrence Statton XE2/N1GAK <[EMAIL PROTECTED]> > I am using Spreadsheet::WriteExcel to populate certain > columns which is working, but in column A for example > I am using the method write_col which requires a > reference, Not just "a reference" but an ARRAY reference for all the values th

RE: reg exp continued need pulled from reference

2006-12-13 Thread Charles K. Clarkson
Derek B. Smith wrote: : I then tried Try something simpler, not more complex. Test this case. my @hosts = ( 'sun' ); $worksheet->write_col( 'A2', [EMAIL PROTECTED], $sheet_format ); If it fails testing then there may be a problem with write_col() or with the

Re: reg exp continued need pulled from reference

2006-12-13 Thread Derek B. Smith
--- Lawrence Statton XE2/N1GAK <[EMAIL PROTECTED]> wrote: > If you're dealing with variable length strings, > separated by some kind > of character, then regexp is the tool you want, not > substr. > > This snippet will work so long as hostname and > platform name are made > up of \w ... if not, su

Re: reg exp

2006-12-12 Thread Derek B. Smith
--- "D. Bolliger" <[EMAIL PROTECTED]> wrote: > Derek B. Smith am Dienstag, 12. Dezember 2006 23:19: > > I have a string like so: > > > > /home/dbsmith/passwd.oftappp1.hpux and I need to > parse > > out oftappp1 and hpux. > > > > I have tried to use substr and and regexp with =~. > > Here is what

Re: reg exp

2006-12-12 Thread I . B .
or just: my $filename="/home/dbsmith/passwd.duby02.linux"; my ($pass,$hostname,$platform)=split /\./, $filename; ~i On 12/12/06, Lawrence Statton XE2/N1GAK <[EMAIL PROTECTED]> wrote: If you're dealing with variable length strings, separated by some kind of character, then regexp is the tool

Re: reg exp

2006-12-12 Thread Lawrence Statton XE2/N1GAK
If you're dealing with variable length strings, separated by some kind of character, then regexp is the tool you want, not substr. This snippet will work so long as hostname and platformname are made up of \w ... if not, substitute in an appropriate character class. #!/usr/bin/perl use strict; u

Re: reg exp

2006-12-12 Thread John W. Krahn
Derek B. Smith wrote: > I have a string like so: > > /home/dbsmith/passwd.oftappp1.hpux and I need to parse > out oftappp1 and hpux. > > I have tried to use substr and and regexp with =~. > Here is what I have tried, but need some help cause I > am getting frustrated. > > NOTE: strings after pas

Re: reg exp

2006-12-12 Thread D. Bolliger
Derek B. Smith am Dienstag, 12. Dezember 2006 23:19: > I have a string like so: > > /home/dbsmith/passwd.oftappp1.hpux and I need to parse > out oftappp1 and hpux. > > I have tried to use substr and and regexp with =~. > Here is what I have tried, but need some help cause I > am getting frustrated.

reg exp

2006-12-12 Thread Derek B. Smith
I have a string like so: /home/dbsmith/passwd.oftappp1.hpux and I need to parse out oftappp1 and hpux. I have tried to use substr and and regexp with =~. Here is what I have tried, but need some help cause I am getting frustrated. NOTE: strings after passwd are variable in length, could be 3-10

Re: reg exp speed?

2006-05-21 Thread John W. Krahn
Alan Campbell wrote: > hello folks, Hello, > Thanks for all the advice. As several of you suggested, the winning ticket > turned out to be flipping to line-by-line regex from an array-slurped > input i.e. > > # look for potentially problematic dissassembly of the following form: - > # 8004b980

Re: reg exp speed?

2006-05-21 Thread Dr.Ruud
Alan Campbell schreef: Please don't top-post. > # look for potentially problematic dissassembly of the following > form: - # 8004b980 003c34f4 STW.D2T1 A0,*B15--[1] > my @dis_lines = <>; > foreach my $ln (@dis_lines) { > if ($ln =~ m/.*ST[A-Z].*B15--.*[13579]]/) { >

Re: reg exp speed?

2006-05-21 Thread Alan Campbell
ing in a large file and seeing a nice speedup versus line by line > processing...but I'm losing it in my (likely poorly constructed!) > reg-expression match > > I do: - > # > # look for potentially problematic code of the following form: - > # STW b0, *SP--[3] > # The reg ex

Re: reg exp speed?

2006-05-20 Thread John W. Krahn
lematic code of the following form: - > # STW b0, *SP--[3] > # The reg exp tries to match: - > # - anything up until 'ST' (so that we match STH, STW, STDW etc) followed by > # - 1+ non-whitespace chars followed by > # - 0+ whitespace chars followed by > # - 0+ non

Re: reg exp speed?

2006-05-19 Thread Dr.Ruud
# STW b0, *SP--[3] ># The reg exp tries to match: - ># - anything up until 'ST' (so that we match STH, STW, STDW etc) >followed by # - 1+ non-whitespace chars followed by ># - 0+ whitespace chars followed by ># - 0+ non-whitespace chars followe

Re: reg exp speed?

2006-05-19 Thread David Romano
ode of the following form: - # STW b0, *SP--[3] # The reg exp tries to match: - # - anything up until 'ST' (so that we match STH, STW, STDW etc) followed by # - 1+ non-whitespace chars followed by # - 0+ whitespace chars followed by # - 0+ non-whitespace chars followed by

RE: reg exp speed?

2006-05-19 Thread Timothy Johnson
his case or not, but it's something to check. -Original Message- From: Alan Campbell [mailto:[EMAIL PROTECTED] Sent: Friday, May 19, 2006 3:13 PM To: beginners@perl.org Subject: reg exp speed? hello folks, I'm slurping in a large file and seeing a nice speedup versu

reg exp speed?

2006-05-19 Thread Alan Campbell
0, *SP--[3] # The reg exp tries to match: - # - anything up until 'ST' (so that we match STH, STW, STDW etc) followed by # - 1+ non-whitespace chars followed by # - 0+ whitespace chars followed by # - 0+ non-whitespace chars followed by # the string 'B15--' followe

Re: 'medium' reg exp greediness?

2006-04-30 Thread Alan Campbell
ed entities from the input XML. I'm open to using a module but pure reg exp (non line-by-line) seems faster...and speed is important in this case due to filesize. Grateful for any ideas u may have. Cheers, Alan Jay Savage <[EMAIL PROTECTED]> wrote: On 4/29/06, Alan Campbel

Re: 'medium' reg exp greediness?

2006-04-29 Thread Jay Savage
On 4/29/06, Alan Campbell <[EMAIL PROTECTED]> wrote: hello folks, I'm trying to do a 'medium' greediness regular expression. Here's what I mean. I need to grab all of the DW_TAG_TI_reserved stuff and kill it (italics below) DW_TAG_TI_assign_regis

'medium' reg exp greediness?

2006-04-29 Thread Alan Campbell
p until last which is too muchkills stuff I need to keep. But .*? is too lazy...it doesnt handle the nesting ie only kills up until the first . To further complicate life, I cant guarentee the level of nesting. Any ideas on how best to reg exp this? Or do I just need to improv

Re: reg exp help

2006-04-27 Thread Jay Savage
On 4/27/06, sandy <[EMAIL PROTECTED]> wrote: > Hi, > > > The content of file hello.c is as given below. > I want to count how many + and - are there in this file. > I had equivalent shel command to count no. of + and -, > > grep -e "^+[^+]" diffs.txt | wc -l > grep -e "^-[^-]" diffs.txt | wc -l >

reg exp help

2006-04-27 Thread sandy
-- Hi, The content of file hello.c is as given below. I want to count how many + and - are there in this file. I had equivalent shel command to count no. of + and -, grep -e "^+[^+]" diffs.txt | wc -l grep -e "^-[^-]" diffs.txt | wc -l Can anyone help me how to write perl script using

Re: strange result with reg exp

2005-09-14 Thread Jeff 'japhy' Pinyan
On Sep 14, Christopher Spears said: In the script I am writing, I use the following regular expression: $pass =~ tr/a-z/A-Z/s; If I give the expression a string like "Occ", then the expression will convert it to "OC" instead of "OCC"! What is going on? It sounds like you're using an operator

Re: strange result with reg exp

2005-09-14 Thread John W. Krahn
Christopher Spears wrote: > In the script I am writing, I use the following > regular expression: > > $pass =~ tr/a-z/A-Z/s; > > If I give the expression a string like "Occ", then the > expression will convert it to "OC" instead of "OCC"! > What is going on? tr/// does NOT use regular expressio

RE: strange result with reg exp

2005-09-14 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Christopher Spears wrote: > In the script I am writing, I use the following > regular expression: > > $pass =~ tr/a-z/A-Z/s; > > If I give the expression a string like "Occ", then the > expression will convert it to "OC" instead of "OCC"! > What is going on? the /s says to squash ( Progr

strange result with reg exp

2005-09-14 Thread Christopher Spears
In the script I am writing, I use the following regular expression: $pass =~ tr/a-z/A-Z/s; If I give the expression a string like "Occ", then the expression will convert it to "OC" instead of "OCC"! What is going on? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:

Re: reg exp using \G

2005-08-03 Thread DBSMITH
cc Please respond to Subject Jay Savage Re: reg exp using \G

Re: reg exp using \G

2005-08-02 Thread Jay Savage
Please don't top post. I think you've been asked this before. On 8/2/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > ok I understand now...thanks, but I tried it and it is still stopping at > original1.1 > I then modified it to print YE if ($1) but never saw YE in STDOUT. Tha's becau

Re: reg exp using \G

2005-08-02 Thread DBSMITH
03:11 cc PM Subject Re: reg exp using \G Please resp

Re: reg exp using \G

2005-08-02 Thread Dave Gray
On 8/2/05, Dave Gray <[EMAIL PROTECTED]> wrote: > On 8/2/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > yes but the problem is my start point and end point have identical entries > > under them. It is stopping at original1.1 when I need for it to stop at > > the end of original1.1 and print

Re: reg exp using \G

2005-08-02 Thread Dave Gray
On 8/2/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > yes but the problem is my start point and end point have identical entries > under them. It is stopping at original1.1 when I need for it to stop at > the end of original1.1 and print > > media: sf > Volumes: >STK000 > Total space av

Re: reg exp using \G

2005-08-02 Thread DBSMITH
PM Subject Re: reg exp using \G Please respond to Dav

Re: reg exp using \G

2005-08-02 Thread Dave Gray
On 8/2/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > technically you are correct about escaping the dot, but in this particular > situation my regexp is working. I will escape the dot. > my goal again is to print from one sting to another from "allsets" > down. I apologize for the long o

Re: reg exp using \G

2005-08-02 Thread John Doe
[EMAIL PROTECTED] am Dienstag, 2. August 2005 19.36: > reg exp using \G > Datum: 2.8.05  19:36:44 > Von: [EMAIL PROTECTED] > An: beginners@perl.org > > All, > > I think I am on the right track as far as what assertion to use.  I need to > print from one string to ano

Re: reg exp using \G

2005-08-02 Thread DBSMITH
PM Subject Re: reg exp using \G Please respond to

Re: reg exp using \G

2005-08-02 Thread Dave Gray
On 8/2/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I think I am on the right track as far as what assertion to use. I need to > print from one string to another using .. with \G Why do you want to use \G? > My goal is to capture from allsets down. > Here is my code: > > #!/usr/bin/perl >

reg exp using \G

2005-08-02 Thread DBSMITH
All, I think I am on the right track as far as what assertion to use. I need to print from one string to another using .. with \G My goal is to capture from allsets down. thank you Here is my code: #!/usr/bin/perl use strict; use warnings; $ENV{PATH} = qq(/opt/SUNWsamfs/sbin:/usr/bin); open

Re: reg exp help

2005-06-28 Thread Jay Savage
On 6/28/05, Jay Savage <[EMAIL PROTECTED]> wrote: > On 6/28/05, Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> wrote: > > On Jun 28, [EMAIL PROTECTED] said: > > > > > but here is another piece of code I tried and this worked as well > > > considering the attachment: > > > > > > comments on the below block

Re: reg exp help

2005-06-28 Thread Jay Savage
On 6/28/05, Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> wrote: > On Jun 28, [EMAIL PROTECTED] said: > > > but here is another piece of code I tried and this worked as well > > considering the attachment: > > > > comments on the below block? > [snip] > > if (m/begin pgp public key block/ig) { > > $lc

Re: reg exp help

2005-06-28 Thread Jeff 'japhy' Pinyan
On Jun 28, [EMAIL PROTECTED] said: but here is another piece of code I tried and this worked as well considering the attachment: comments on the below block? [snip] if (m/begin pgp public key block/ig) { $lc=1; } if ( $lc==1){ print $_; } if (m/end pgp public key block/ig) { $lc=0; }

Re: reg exp help

2005-06-28 Thread Jay Savage
On 6/28/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Actually, > > you are incorrect... The +>> mean read and write in append mode. Please > see the follow up email with the attachment I sent. > > Derek B. Smith > OhioHealth IT > UNIX / TSM / EDM Teams > 614-566-4145 While you are correct

  1   2   3   >