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

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
Surely not perfect but this seems to work... $lin = "2011/05/25 07:24:58 -0700 PDT"; $lin =~ /(^\d+\/\d+\/\d+).*/; print "$1\n"; Marco van Kammen Applicatiebeheerder Mirabeau | Managed ServicesDr. C.J.K. van Aalstweg 8F 301, 1625 NV Hoorn +31(0)20-5950550 - www.mirabeau.nl Please c

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

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

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

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]

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.

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
hello folks, 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 003c34f4 STW.D2T1

Re: reg exp speed?

2006-05-20 Thread John W. Krahn
Alan Campbell wrote: > hello folks, Hello, > I'm slurping 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:

Re: reg exp speed?

2006-05-19 Thread Dr.Ruud
Alan Campbell schreef: > I'm slurping in a large file and seeing a nice speedup > versus line by line processing... I would go back to line-by-line again if the regexp should only match within one line. ># look for potentially problematic code of the following form: - ># STW b0, *SP--[

Re: reg exp speed?

2006-05-19 Thread David Romano
Hi Alan, On 5/19/06, Alan Campbell wrote: hello folks, I'm slurping 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 followi

RE: reg exp speed?

2006-05-19 Thread Timothy Johnson
One thing you could do is precompile the regex and save it in a variable ala my $regex = qr/.*ST\S+\s*\S*B15--.*[^02468]]/o; my @match_sp = $all_lines =~ /$regex/mg; Note the 'o' option on the qr//, which tells perl to compile the regex only once. I'm not sure if it applies in this case or not,

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 >

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 another using .. with \G Your b

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 >

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

Re: reg exp help

2005-06-28 Thread Jeff 'japhy' Pinyan
On Jun 28, [EMAIL PROTECTED] said: for (;;) { if (/^-{5,}(\w+)/ig) { print $_; } $lc++; } I want to print everything from BEGIN TO END and right now all I am printing is the begin and end lines. If that's what you want, you should use two regexes with the .. operator: while ()

Re: reg exp help

2005-06-28 Thread Jay Savage
On 6/28/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Can anyone help me with this match: [snip] > for (;;) > { > if (/^-{5,}(\w+)/ig) { > print $_; > > } >

Re: reg exp help

2005-06-28 Thread DBSMITH
Subject Please respond to Re: reg exp help bright true <[EMAIL PROTECTED]

Re: reg exp help

2005-06-28 Thread bright true
Hello, First of all you're opening the file for writing Second i didn't understand what you really want , if you want to print out everything inside the file my $file = 'newfile.txt'; open(FILE,$file); while(){ print $_;} close(FILE); That's it with out matching or anything bye On 6/2

Re: Reg Exp Help

2005-03-10 Thread Gretar M Hreggvidsson
Hi If "Request timed out" occurs in the output from PING command you can be quite sure that the request timed out. :-) Therefore it's be bit to much hazzle to check for embedded newlines (using the \m modifier), one could just say: if ($machine_status =~ /Request timed out\./) { Remember to es

Re: Reg Exp Help

2005-03-09 Thread John W. Krahn
Trina Espinoza wrote: Var $machine_status contains this block of data: machine_status = "Pinging 129.111.3.79 with 32 bytes of data: Request timed out. Request timed out. Request timed out. Request timed out. Ping statistics for 192.111.3.79: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss)

Re: reg exp

2005-03-07 Thread John Doe
Am Montag, 7. März 2005 19.54 schrieben Sie: > is this line > > :>$_=~s{delete}{}; > > a named unary call? Oups? It's just a bad choosen example; I should not have used a reserved word as string content (I realized it after having sent my post) Its simply a regex which deletes the first occ

Re: reg exp

2005-03-07 Thread DBSMITH
TED] Subject Re: reg exp Please respond to security.departme [EMAIL PROTEC

Re: reg exp

2005-03-07 Thread John Doe
Hello Derek Am Montag, 7. März 2005 02.04 schrieb [EMAIL PROTECTED]: > greetings. > > cool beans! What perldoc has ###- -### in it? > ...marked with...?for me is not enough of an explanation. sorry. Sorry, i was just confused. The '#' sign is (at least most of the time) a comment characte

Re: reg exp

2005-03-06 Thread DBSMITH
inners@perl.org 03/06/2005 07:43 cc PM[EMAIL PROTECTED] Subject

Re: reg exp

2005-03-06 Thread John Doe
[EMAIL PROTECTED]> > To >beginners@perl.org > 03/05/2005 01:25 cc > PM[EMAIL PROTECTED] >

Re: reg exp

2005-03-06 Thread DBSMITH
To beginners@perl.org 03/05/2005 01:25 cc PM[EMAIL PROTECTED]

Re: reg exp

2005-03-05 Thread John Doe
Hi Derek > #!/usr/bin/perl > > ## Set pragmas (LC) and modules (UC) > > $^W = 1; > use strict; > use strict 'subs'; > > ## Begin Logic > > $ENV{"PATH"} = qq(/home/root:/usr/bin:/usr/sbin); > > my $w="40"; > my $total="0"; > my $outfile1 = qq(/home/root/tsm2_clients.out); > my $outfile2 = qq(/home/

RE: reg exp

2005-03-05 Thread Charles K. Clarkson
[EMAIL PROTECTED] wrote: : #!/usr/bin/perl : : ## Set pragmas (LC) and modules (UC) : : $^W = 1; If you are using a recent version of perl this is better. Read perllexwarn for details. use warnings; : use strict; This statement includes 'vars', 'subs', and

Re: reg exp

2005-03-05 Thread DBSMITH
To beginners@perl.org 03/04/2005 11:37 cc PM

Re: reg exp

2005-03-04 Thread John W. Krahn
[EMAIL PROTECTED] wrote: I have the file as attached and I want to take 104 and 356 to get a sum. Here is my code: while () { if ( $. > 6 ) { if ( $_ !~ "ANR*" or $_ !~ "ANS*" ) { print FFF $_; } }

Re: reg exp

2005-03-04 Thread John Doe
Hello (again) Derek Am Samstag, 5. März 2005 05.06 schrieb [EMAIL PROTECTED]: > I have the file as attached and I want to take 104 and 356 to get a sum. > Here is my code: > > > while () { > if ( $. > 6 ) { > if ( $_ !~ "ANR*" or $_ !~ "ANS*" ) { >

Re: Reg Exp

2004-10-06 Thread David le Blanc
On Tue, 05 Oct 2004 15:22:25 -0700, John W. Krahn <[EMAIL PROTECTED]> wrote: > [Please do not top-post. TIA] > > > David le Blanc wrote: > > > > On Tue, 05 Oct 2004 04:03:21 -0700, John W. Krahn <[EMAIL PROTECTED]> wrote: > > > >>Mallik wrote: > >> > >>>I have the below code. > >>> > >>>my $a =

Re: Reg Exp

2004-10-05 Thread John W. Krahn
[Please do not top-post. TIA] David le Blanc wrote: On Tue, 05 Oct 2004 04:03:21 -0700, John W. Krahn <[EMAIL PROTECTED]> wrote: Mallik wrote: I have the below code. my $a = ":-:m:-:a:-:l:-:i:-:k"; # Here each letter is separated by :-: my $del = ':-:'; # Delimeter my $b; while ($a ne $b) { $a

RE: Reg Exp

2004-10-05 Thread Chris Devers
On Tue, 5 Oct 2004, Mallik wrote: But I am a new-bie to Perl. Can u give me a example for 'look-ahead' matches. 30 seconds on Google returned *lots* of documentation. Here's some of it:

RE: Reg Exp

2004-10-05 Thread Mallik
ubject: Re: Reg Exp Your use of (.?)($del)? does not do what you expect. In the case of :-:a:-: you will find (.?) = 'a' and ($del)? matches a delimiter, BUT :-::-:you will find (.?) = ":" and ($del)? matches nothing. Check out 'look-ahead' matches for a way

Re: Reg Exp

2004-10-05 Thread David le Blanc
Your use of (.?)($del)? does not do what you expect. In the case of :-:a:-: you will find (.?) = 'a' and ($del)? matches a delimiter, BUT :-::-:you will find (.?) = ":" and ($del)? matches nothing. Check out 'look-ahead' matches for a way to solve this. On Tue, 05 Oct 2004 04:03:21 -070

Re: Reg Exp

2004-10-05 Thread John W. Krahn
Mallik wrote: Dear Friends, Hello, I have the below code. my $a = ":-:m:-:a:-:l:-:i:-:k"; # Here each letter is separated by :-: my $del = ':-:'; # Delimeter my $b; while ($a ne $b) { $a =~ /^$b$del(.?)($del)?/; my $c = $1; print "$c\n"; $b .= $del . $c; } The above code is working

Re: Reg. Exp. to find dir. question

2003-07-31 Thread Quenten Griffith
Thank you that worked, and thank you for the tip about chomp/chop --- Rob Dixon <[EMAIL PROTECTED]> wrote: > > "Quenten Griffith" <[EMAIL PROTECTED]> wrote in > message > news:[EMAIL PROTECTED] > > Hello all I have a script that reads in a control > file > > that list a dir. to > > change to insid

Re: Reg. Exp. to find dir. question

2003-07-31 Thread Rob Dixon
Rob Dixon wrote: > > > This line is what I am having an issue with $dir = $1 > > if > > /^Dir:\s+(\W\w+\W\w+)/; > > That will match /your/path but it will not match /your > > or /your/path/is. > > > Is there a better reg.exp. I can use that will match > > anything with a / in and everything after

Re: Reg. Exp. to find dir. question

2003-07-31 Thread Rob Dixon
"Quenten Griffith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello all I have a script that reads in a control file > that list a dir. to > change to inside the control file I have > > Dir: /cf/courseware > > The part of the Perl script that I run to pull in that > info is > >

Re: Reg Exp Help...

2003-07-22 Thread wiggins
OTECTED]> > Sent: Wednesday, July 23, 2003 1:21 AM > Subject: RE: Reg Exp Help... > > > > > > > > On 22 Jul 2003 09:15:29 -0700, James Kelty <[EMAIL PROTECTED]> wrote: > > > > > I know that this is

Re: Reg Exp Help...

2003-07-22 Thread John W. Krahn
James Kelty wrote: > > I know that this is a common request, but I have a question about > parsing an email box. I have a UW IMAP box, and I am trying to extract > all the emails where the line starts with From: blah blah. Now, getting > those lines isn't the issue, but since each email is a littl

Re: Reg Exp Help...

2003-07-22 Thread LI NGOK LAM
- Original Message - From: <[EMAIL PROTECTED]> To: "James Kelty" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, July 23, 2003 1:21 AM Subject: RE: Reg Exp Help... > > > On 22 Jul 200

RE: Reg Exp Help...

2003-07-22 Thread wiggins
On 22 Jul 2003 09:15:29 -0700, James Kelty <[EMAIL PROTECTED]> wrote: > I know that this is a common request, but I have a question about > parsing an email box. I have a UW IMAP box, and I am trying to extract > all the emails where the line start

RE: Reg Exp

2002-10-04 Thread nkuipers
eff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] >> Sent: Friday, October 04, 2002 11:20 AM >> To: Kipp, James >> Cc: [EMAIL PROTECTED] >> Subject: RE: Reg Exp >> >> >> >> $dna =~ m{ >> >> (?= >> >> tag >

RE: Reg Exp

2002-10-04 Thread Kipp, James
October 04, 2002 11:20 AM > To: Kipp, James > Cc: [EMAIL PROTECTED] > Subject: RE: Reg Exp > > > >> $dna =~ m{ > >> (?= > >> tag > >> (?: > >> .*? tag > >> # the substr(...) is

RE: Reg Exp

2002-10-04 Thread Jeff 'japhy' Pinyan
>> $dna =~ m{ >> (?= >> tag >> (?: >> .*? tag >> # the substr(...) is there to avoid using $& >> (?{ push @matches, substr($dna, $-[0], $+[0] - $-[0]) }) >> )+ >> ) >> (?!) >> }x; First of all, I haven't benchmarked, and I had thought of d

RE: Reg Exp

2002-10-04 Thread Kipp, James
> > Here is my solution: > > my $dna = ...; > my @matches; > > $dna =~ m{ > (?= > tag > (?: > .*? tag > # the substr(...) is there to avoid using $& > (?{ push @matches, substr($dna, $-[0], $+[0] - $-[0]) }) > )+ > ) > (?!) > }x; > >

Re: Reg Exp

2002-10-04 Thread John W. Krahn
Cedric wrote: > > First of all, sorry for my poor english. > I work with DNA sequence and want to extract relevant motives of course > using regular expression. > A concrete example will be better than a long description of my problem, so: > > Here is a string corresponding to my DNA strand : >

Re: Reg Exp

2002-10-04 Thread Jeff 'japhy' Pinyan
On Oct 4, Cedric said: >cgttgctagctgctatcgatgtgctagtcgatgctagtgcatgcgtagtgcagtcatatgctaggcat > >I want to extract all the substrings beginning with tag and finishing with >tag including substrings with same start point but different length like : > >tagctgctatcgatgtgctag >tagctgctatcgatgtgctagtcg

Re: reg exp help!

2002-03-26 Thread Jenda Krynicky
From: "David Samuelsson (PAC)" <[EMAIL PROTECTED]> > i got this line in an array allready, if i do a print off the array it > prints this line. > > Last accessed 08-mar-02.10:27:55 by fdefgre.Domain > [EMAIL PROTECTED] > > what i want to do now is only pick out the date that is the > "08-mar-0

RE: Reg Exp help

2002-02-27 Thread Busse, Rich
Thanks Daryl & 'Japhy' for your suggestions. I ended up using: $Out = `$Cmd` ; $Out =~ /^\|GRP\|\s*(.*)/m ; The data I want ends up in $1. -Original Message- From: Busse, Rich Sent: Tuesday, 26 February, 2002 09:35 To: Perl Beginners Subject: Reg Exp help I am capturi

RE: Reg Exp help

2002-02-26 Thread Jeff 'japhy' Pinyan
On Feb 26, Daryl J. Hoyt said: >If there is only one of the lines |GRP| this will work. Otherwise I would >push the lines into a an array instead of a variable. > >@Out = `$Cmd`; >$WhatFollowsGRP = ""; > >foreach my $line (@Out) >{ > if($line =~ /|GRP|/) You need to escape those |'s. They

Re: Reg Exp help

2002-02-26 Thread Jeff 'japhy' Pinyan
On Feb 26, Busse, Rich said: > $Out = `$Cmd` ; > >The output always looks like: > >List of Templates and Template Groups assigned to 'somenode.us.dnb.com': > >|GRP| SBS-DSM >=

RE: Reg Exp help

2002-02-26 Thread Daryl J. Hoyt
If there is only one of the lines |GRP| this will work. Otherwise I would push the lines into a an array instead of a variable. @Out = `$Cmd`; $WhatFollowsGRP = ""; foreach my $line (@Out) { if($line =~ /|GRP|/) { $line =~ s/|GRP|//; $WhatFollowsGR

  1   2   >