RE: match pattern

2009-09-19 Thread Wagner, David --- Senior Programmer Analyst --- CFS
> -Original Message- > From: raphael() [mailto:raphael.j...@gmail.com] > Sent: Friday, September 18, 2009 10:40 > To: Perl BEGIN > Subject: match pattern > > Hi > > How do I pick out matching words if there are more than one > on the same > line? > > > Example > > INFILE.TXT > > www

Re: match pattern

2009-09-18 Thread Uri Guttman
> "JB" == Jim Bauer writes: >> if ( m!(www.\S+.com)!s ) { JB> Try m!(www.\S+.com)!sg don't use alternate delimiters unless you must. it makes for harder to read code. stick with // unless you have a / inside the regex. and the best alternate delimiters are paired ones like {} as they are

Re: match pattern

2009-09-18 Thread Jim Bauer
"raphael()" wrote on Fri, 18 Sep 2009 22:10:01 +0530: >Hi > >How do I pick out matching words if there are more than one on the same >line? > > >Example > >INFILE.TXT > >www.site01.com www.site02.com www.site03.com >www.site04.com > >-- > >while (<>) { >if ( m!(www.\S+.com)!s ) { Try m!(

Re: match pattern

2009-09-18 Thread Shawn H Corey
raphael() wrote: Hi How do I pick out matching words if there are more than one on the same line? Example INFILE.TXT www.site01.com www.site02.com www.site03.com www.site04.com -- while (<>) { if ( m!(www.\S+.com)!s ) { # print "$1\n"; # print "$&\n"; print;

Re: Match pattern and print next line

2002-11-25 Thread david
Joshua Kaufman wrote: > Bob - > > Thanks, I'll investigate that. > > I'm also hoping that the list will tell me how to do it by incrementing > the proper special variable. I could swear that I've done that before, and > have found it useful in other contexts. > > > -- Josh > The $. variable

Re: Match pattern and print next line

2002-11-24 Thread badchoice
an alternative: $&&&print, /- Student Id|$/ for ; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Match pattern and print next line

2002-11-23 Thread John W. Krahn
Joshua Kaufman wrote: > > Hi All; Hello, > I'm trying to match a pattern in a text file and then print out the next > line in that file. I could swear that I've done this before by incrementing > $. to move to the next line. However, the code below is printing out the > matched line rather than

Re: Match pattern and print next line

2002-11-23 Thread Wiggins d'Anconia
Yeh I would tend to agree, based on the fact that you can have multiple handles open at the same time. So there would have to be like a hash or something if it were a special variable which you would have to update for each handle, on top of that you can make a handle a lexical variable which d

Re: Match pattern and print next line

2002-11-23 Thread Joshua Kaufman
How unfortunate for me ;-) -- josh On 11/23/02 2:17 PM, "Paul Johnson" <[EMAIL PROTECTED]> wrote: > On Sat, Nov 23, 2002 at 02:05:58PM -0600, Joshua Kaufman wrote: > >> Thanks for the reply. >> >> That would work in this context, but I'm looking for the more general >> answer, mostly just to co

Re: Match pattern and print next line

2002-11-23 Thread Paul Johnson
On Sat, Nov 23, 2002 at 02:05:58PM -0600, Joshua Kaufman wrote: > Thanks for the reply. > > That would work in this context, but I'm looking for the more general > answer, mostly just to convince myself that I'm not crazy and have done it > this way before. I'm sorry to report that you may be c

Re: Match pattern and print next line

2002-11-23 Thread Joshua Kaufman
Thanks for the reply. That would work in this context, but I'm looking for the more general answer, mostly just to convince myself that I'm not crazy and have done it this way before. --Josh On 11/23/02 8:44 AM, "Wiggins d'Anconia" <[EMAIL PROTECTED]> wrote: > You could always say again insid

Re: Match pattern and print next line

2002-11-23 Thread Joshua Kaufman
Bob - Thanks, I'll investigate that. I'm also hoping that the list will tell me how to do it by incrementing the proper special variable. I could swear that I've done that before, and have found it useful in other contexts. -- Josh -- On 11/23/02 12:39 PM, "Mystik gotan" <[EMAIL PROTECTED]> w

Re: Match pattern and print next line

2002-11-23 Thread Wiggins d'Anconia
You could always say again inside your if to print the next line. Realize that you will not then be able to check that line for the string, but if that is ok which it sounds like it is then it should work. See below. Joshua Kaufman wrote: Hi All; I'm trying to match a pattern in a text file