RE: Matching Question

2009-06-02 Thread Farrell, Patrick
: Saturday, May 30, 2009 3:49 AM To: Perl Beginners Subject: Re: Matching Question Farrell, Patrick wrote: This is roughly what I am trying to do. Surround lower case strings within a string with tags. === $msgText=THIS IS MY test STRING

Re: Matching Question

2009-06-01 Thread John W. Krahn
Farrell, Patrick wrote: Thanks. What if I added numbers like this $msgText =~ s!(?= )([a-z,0-9]+)(?= )!bold$1/bold!g; Did you really want to include a comma as part of that character class? But I didn't want a string of only numbers? In the strings I waned, I know the first character

Matching Question

2009-05-30 Thread Farrell, Patrick
This is roughly what I am trying to do. Surround lower case strings within a string with tags. === $msgText=THIS IS MY test STRING; $msgText =~ m/ [a-z]+ /; #or $msgText =~ /\s[a-z]+\s/; if(defined($1)){ $1=~ s/\s+//g;

Re: Matching Question

2009-05-30 Thread John W. Krahn
Farrell, Patrick wrote: This is roughly what I am trying to do. Surround lower case strings within a string with tags. === $msgText=THIS IS MY test STRING; $msgText =~ m/ [a-z]+ /; #or $msgText =~ /\s[a-z]+\s/; if(defined($1)){ That

Pattern matching question

2009-04-01 Thread Richard Hobson
Hi, Please be patient with this beginner. I have a subrouting as follows, that prints out an ASCII representation of chess board sub display_board { foreach (0..7) { my $ref = @_[$_]; foreach (0..7) { my $piece = $ref-[$_];

AW: Pattern matching question

2009-04-01 Thread Thomas Bätzler
Richard Hobson m...@richardhobson.com wrote: Please be patient with this beginner. I have a subrouting as follows, that prints out an ASCII representation of chess board sub display_board { foreach (0..7) { my $ref = @_[$_]; foreach (0..7) {

Re: AW: Pattern matching question

2009-04-01 Thread Richard Hobson
Firstly, apologies for the double posting of this question. On Wed, 01 Apr 2009 09:49 +0200, Thomas Bätzler t.baetz...@bringe.com wrote: How about (untested): sub display_board { foreach my $ref (@_){ foreach my $piece ( @$ref ){ print substr( $piece, -2); } } }

Pattern matching question

2009-03-31 Thread Richard Hobson
Hi, Please be patient with this beginner. I have a subrouting as follows, that prints out an ASCII representation of chess board sub display_board { foreach (0..7) { my $ref = @_[$_]; foreach (0..7) { my $piece = $ref-[$_];

Re: Pattern matching question

2009-03-31 Thread Telemachus
On Tue Mar 31 2009 @ 3:32, Richard Hobson wrote: It works, but is there a way of combining these lines: my $piece = $ref-[$_]; $piece =~ /.*(..$)/; It feels like this could be done in one step. Is this correct? I'm finding that I'm doing

Re: Pattern matching question

2009-03-31 Thread John W. Krahn
Richard Hobson wrote: Hi, Hello, Please be patient with this beginner. I have a subrouting as follows, that prints out an ASCII representation of chess board sub display_board { foreach (0..7) { my $ref = @_[$_]; That should be: my $ref = $_[$_]; Or better:

RE: pattern matching question

2008-09-23 Thread sanket vaidya
] Sent: Tuesday, September 23, 2008 6:52 AM To: beginners@perl.org Subject: pattern matching question here is my problem: i have to check the entries of a column and write them out to a file if they happen to be DNA sequences ie they are exclusively composed of the letters A, T, G, C- no spaces

Re: pattern matching question

2008-09-23 Thread Mr. Shawn H. Corey
On Mon, 2008-09-22 at 21:21 -0400, ANJAN PURKAYASTHA wrote: here is my problem: i have to check the entries of a column and write them out to a file if they happen to be DNA sequences ie they are exclusively composed of the letters A, T, G, C- no spaces or digits. the column also happens to

RE: pattern matching question

2008-09-23 Thread sanket vaidya
PROTECTED] Sent: Tuesday, September 23, 2008 6:52 AM To: beginners@perl.org Subject: pattern matching question here is my problem: i have to check the entries of a column and write them out to a file if they happen to be DNA sequences ie they are exclusively composed of the letters A, T, G, C

Re: pattern matching question

2008-09-23 Thread ANJAN PURKAYASTHA
To: beginners@perl.org Subject: pattern matching question here is my problem: i have to check the entries of a column and write them out to a file if they happen to be DNA sequences ie they are exclusively composed of the letters A, T, G, C- no spaces or digits. the column also happens to have

Pattern matching question

2008-09-23 Thread Darren Nay
Hey All, I hope that you can help me. I have been struggling with this issue the past couple of hours and can't seem to get it to work. I am trying to get a value through pattern matching. Here is the string: xsl:output method=html encoding=utf-8 indent=yes

Re: Pattern matching question

2008-09-23 Thread Mr. Shawn H. Corey
On Tue, 2008-09-23 at 14:05 -0700, Darren Nay wrote: Here is the string: xsl:output method=html encoding=utf-8 indent=yes doctype-system=http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; doctype-public=-//W3C//DTD XHTML 1.0 Transitional//EN / Now, I want to match against that string

pattern matching question

2008-09-22 Thread ANJAN PURKAYASTHA
here is my problem: i have to check the entries of a column and write them out to a file if they happen to be DNA sequences ie they are exclusively composed of the letters A, T, G, C- no spaces or digits. the column also happens to have other strings that are made of word/digit/space characters. i

RE: pattern matching question

2008-09-22 Thread Dave
-Original Message- From: ANJAN PURKAYASTHA [mailto:[EMAIL PROTECTED] Sent: Tuesday, 23 September 2008 11:22 AM To: beginners@perl.org Subject: pattern matching question here is my problem: i have to check the entries of a column and write them out to a file if they happen to be DNA

Multiple matching question

2006-08-10 Thread Roman Daszczyszak
Hello all, I have several text files with a few thousand contacts in each, and I am trying to pull out all the contacts from certain email domains (about 15 of them). I wrote a script that loops through each file, then loops through matching each domain to the line and writes the results to two

Re: Multiple matching question

2006-08-10 Thread Rob Dixon
Roman Daszczyszak wrote: I have several text files with a few thousand contacts in each, and I am trying to pull out all the contacts from certain email domains (about 15 of them). I wrote a script that loops through each file, then loops through matching each domain to the line and writes

Re: Multiple matching question

2006-08-10 Thread Mumia W.
On 08/10/2006 09:12 AM, Roman Daszczyszak wrote: Hello all, I have several text files with a few thousand contacts in each, and I am trying to pull out all the contacts from certain email domains (about 15 of them). I wrote a script that loops through each file, then loops through matching

Re: Multiple matching question

2006-08-10 Thread John W. Krahn
Roman Daszczyszak wrote: Hello all, Hello, I have several text files with a few thousand contacts in each, and I am trying to pull out all the contacts from certain email domains (about 15 of them). I wrote a script that loops through each file, then loops through matching each domain to

Re: Pattern Matching Question

2005-11-28 Thread Dr.Ruud
Dax Mickelson schreef: I am having problems matching ALL possible matches of a string against another (very large) string. I am doing something like: @LargeArray = ($HugeString =~ m/$Head/ig); Where $Head is an 8 character string. (Basically I want to get all 16 character long

Re: Pattern Matching Question

2005-11-28 Thread Dr.Ruud
Dr.Ruud: #!/usr/bin/perl use strict; use warnings; { local ($,, $\) = (':', \n); $_ = 'AASDFGHJKL'; my $Head = ''; print $Head, $1, substr($',0,7) while /(?=$Head)(.)(?=.{7})/ig; } Revision: #!/usr/bin/perl use strict; use warnings; my

Re: Pattern Matching Question

2005-11-28 Thread Jeff 'japhy' Pinyan
On Nov 27, Dax Mickelson said: I am having problems matching ALL possible matches of a string against another (very large) string. I am doing something like: @LargeArray = ($HugeString =~ m/$Head/ig); Where $Head is an 8 character string. (Basically I want to get all 16 character

Pattern Matching Question

2005-11-27 Thread Dax Mickelson
I am having problems matching ALL possible matches of a string against another (very large) string. I am doing something like: @LargeArray = ($HugeString =~ m/$Head/ig); Where $Head is an 8 character string. (Basically I want to get all 16 character long substrings out of $HugeString

RE: Pattern Matching Question

2005-11-27 Thread S, karthik \(IE03x\)
: Monday, November 28, 2005 12:05 PM To: beginners@perl.org Subject: Pattern Matching Question I am having problems matching ALL possible matches of a string against another (very large) string. I am doing something like: @LargeArray = ($HugeString =~ m/$Head/ig); Where $Head is an 8

Re: Pattern Matching Question

2005-11-27 Thread John W. Krahn
Dax Mickelson wrote: I am having problems matching ALL possible matches of a string against another (very large) string. I am doing something like: @LargeArray = ($HugeString =~ m/$Head/ig); Where $Head is an 8 character string. (Basically I want to get all 16 character long

pattern matching question - please help

2005-06-19 Thread MEENA SELVAM
Hi, can anyone please explain? In the following code snippet, what is the meaning of the pattern match s/^.*\/// $prog = $0; $prog =~ s/^.*\/// i did not get details when i searched in google thanks, meena Yahoo! Sports

Re: pattern matching question - please help

2005-06-19 Thread MEENA SELVAM
Hi , in $prog =~ s/^.*\///; is it trying to substitute all characters until the last / within $prog? meena --- MEENA SELVAM [EMAIL PROTECTED] wrote: Hi, can anyone please explain? In the following code snippet, what is the meaning of the pattern match s/^.*\/// $prog = $0; $prog

Re: pattern matching question - please help

2005-06-19 Thread Chris Devers
On Sun, 19 Jun 2005, MEENA SELVAM wrote: can anyone please explain? See `perldoc perlre`, or `man perlre`, or a book like _Learning Perl_ or _Mastering Regular Expressions_ for this kind of thing. It's really an introductory question that any decent introductory text should be able to cover

Re: pattern matching question - please help

2005-06-19 Thread MEENA SELVAM
Hi Chris, Thanks for your detailed email and for your time. I think my second email crossed your email. The book I read on Perl did not mention anything about first and second half, and that didnt explain, me that we were replacing all upsto last / by nothing. I thought it is replacing with /

pattern matching question

2004-12-23 Thread John McCormick
i'm trying to figure out how to split a file delimited by commas and newlines. @data = split (/\n|\,/, infile) the only problem is that some of the data fields are strings enclosed in double quotes, and within some of those double quotes are more commas. that's too tricky for me. how do i do

Re: pattern matching question

2004-12-23 Thread Jonathan Paton
i'm trying to figure out how to split a file delimited by commas and newlines. Sounds like a CSV file to me, and for those you look on CPAN for a ready made solution. http://search.cpan.org/search?query=CSVmode=module Jonathan Paton -- #!perl $J=' 'x25 ;for (qq 1+10 9+14 5-10 50-9 7+13 2-18

Re: pattern matching question

2004-12-23 Thread Chris Charley
- Original Message - From: John McCormick i'm trying to figure out how to split a file delimited by commas and newlines. @data = split (/\n|\,/, infile) the only problem is that some of the data fields are strings enclosed in double quotes, and within some of those double quotes are

Re: pattern matching question

2004-12-23 Thread Chris Devers
On Thu, 23 Dec 2004, John McCormick wrote: i'm trying to figure out how to split a file delimited by commas and newlines. @data = split (/\n|\,/, infile) the only problem is that some of the data fields are strings enclosed in double quotes, and within some of those double quotes are more

Matching question

2002-04-03 Thread Rice, Elizabeth A.
I am trying to find the first occurrance of a date string in several different files in order to re-write all of today's entries back into the existing log file after taking out all the old entries to be archived. (I also realize lots of folks have done this and I'm sure come up with much

Re: Matching question

2002-04-03 Thread John W. Krahn
Elizabeth A. Rice wrote: I am trying to find the first occurrance of a date string in several different files in order to re-write all of today's entries back into the existing log file after taking out all the old entries to be archived. (I also realize lots of folks have done this and

Re: Matching question

2002-04-03 Thread Jenda Krynicky
From: John W. Krahn [EMAIL PROTECTED] Jenda Krynicky wrote: From: John W. Krahn [EMAIL PROTECTED] Elizabeth A. Rice wrote: What I've written so far @ARGV = ($logfile);# prime the diamond operator ^^^^

pattern matching question

2002-02-28 Thread richard noel fell
I have the following bit of code: #!/usr/bin/perl -w open In2,/home/rfell/tutoring/beaven/webproject/tmp/maxima_log or die Cannot open maxima_log:$!; my $Line; while (defined($Line=In2)){ if($Line=~/(\(D\d+\))\s*(\w*)/){ print == $2\n; }; }; #close In2; maxima_log is the following GCL (GNU

Re: pattern matching question

2002-02-28 Thread bob ackerman
On Thursday, February 28, 2002, at 08:37 AM, richard noel fell wrote: while (defined($Line=In2)){ if($Line=~/(\(D\d+\))\s*(\w*)/){ print == $2\n; }; }; disclaimer: i am a rank newbot if i replace '/w*' with '*$' i get desired text looks like \w* doesn't do what we expect problems with

RE: pattern matching question

2002-02-28 Thread Jason Larson
-Original Message- From: richard noel fell [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 28, 2002 10:38 AM To: [EMAIL PROTECTED] Subject: pattern matching question I have the following bit of code: #!/usr/bin/perl -w open In2,/home/rfell/tutoring/beaven/webproject/tmp/maxima_log

RE: pattern matching question

2002-02-28 Thread Jason Larson
-Original Message- From: bob ackerman [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 28, 2002 11:32 AM To: richard noel fell Cc: [EMAIL PROTECTED] Subject: Re: pattern matching question On Thursday, February 28, 2002, at 08:37 AM, richard noel fell wrote: while (defined($Line=In2

Re: real stupid matching question

2001-08-31 Thread Brad
Hi Matt, Note that your while() condition needs !~ instead of =~ (and I don't think the ',' is necessary in the '-{3,}' regex). Otherwise, the code worked for me except when I passed it an empty file. Try testing the value of $oneline before you enter the while loop. -- Brad I am opening a

Re: real stupid matching question

2001-08-31 Thread Michael Fowler
On Fri, Aug 31, 2001 at 02:21:56PM -0400, Matt Fuerst wrote: I am opening a file witht he following command: open (LOGFILE, 100.txt); Where is your || die(...)? $oneline = LOGFILE; while ( $oneline =~ /(-{3,})/ ) { # process one line $oneline = LOGFILE; } LOGFILE

Re: real stupid matching question

2001-08-31 Thread Michael Fowler
On Fri, Aug 31, 2001 at 11:22:18AM -0800, Michael Fowler wrote: $oneline = LOGFILE; while ( $oneline =~ /(-{3,})/ ) { # process one line $oneline = LOGFILE; } I take back my statement that it is working. It's working as implemented, but not as intended. The code you

Re: real stupid matching question

2001-08-31 Thread Bas Bloemsaat
- Original Message - From: Michael Fowler [EMAIL PROTECTED] To: Matt Fuerst [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, August 31, 2001 9:22 PM Subject: Re: real stupid matching question On Fri, Aug 31, 2001 at 02:21:56PM -0400, Matt Fuerst wrote: I am opening a file witht

Forget the last, here's the right one Re: real stupid matching question

2001-08-31 Thread Bas Bloemsaat
while ( $oneline =~ /(-{3,})/ ) why don't you use this:? $oneline =~ /---/ It's more readable (I think), it's shorter, and if you don't care about the number of -'s, faster too. Now I do realize that doesn't matter in this case, but still... -- To unsubscribe, e-mail: [EMAIL

matching question (real newbie...not like you fake newbies out there...)

2001-05-17 Thread Stout, Joel R
I want to get the file names of all EDI files from a certain directory. I do not want ENT (or encrypted) file names. Example: The directory contains: a001.edi a002.edi a003.edi.ent a004.EDI After getting the file name in $_ I did the following match: if (/edi\b/i) { # thinking I would

Re: matching question (real newbie...not like you fake newbies out there...)

2001-05-17 Thread Shawn
/edi$/i I think? On 05/17, John Joseph Trammell rearranged the electrons to read: On Thu, May 17, 2001 at 09:25:53PM -, Stout, Joel R wrote: if (/edi\b/i) { # thinking I would match file names 1, 2, and 4. Instead I matched on all. Wasn't \b supposed to help me out here? Or does Perl