Regex Multi-Line Match

2005-06-20 Thread Jeff Westman
Hello Fellow Perlites, I'm having difficulty parsing a file and could use some help here. I've attached my code, output file, and sample job run. Basically, I want to read an Oracle TNS file (tnsnames.ora) and list the host name and service on that server based on this input file. A sample TNS

Regex Multi line match

2005-03-08 Thread William Melanson
Greetings, This is the multi line pattern in which I wish to match: tr tdb String 1.2.3.4.5.6 /b/td tdimg src=pics/green.gif alt=OK/td tr This is what I have: == #!/usr/bin/perl -w my $file='./index.html'; open INFILE, $file or die

Re: Regex Multi line match

2005-03-08 Thread John Doe
Am Dienstag, 8. März 2005 17.20 schrieb William Melanson: Greetings, Greetings too :-) This is the multi line pattern in which I wish to match: tr tdb String 1.2.3.4.5.6 /b/td tdimg src=pics/green.gif alt=OK/td tr This is what I have:

Re: Regex Multi line match

2005-03-08 Thread Dave Gray
This is the multi line pattern in which I wish to match: tr tdb String 1.2.3.4.5.6 /b/td tdimg src=pics/green.gif alt=OK/td tr One way to solve this would be to read lines from the file and save chunks of N lines (4 in this case) in a temp variable. Then your regex would operate on enough

Re: Regex Multi line match

2005-03-08 Thread Jay Savage
On Tue, 8 Mar 2005 13:42:44 -0500, Dave Gray [EMAIL PROTECTED] wrote: This is the multi line pattern in which I wish to match: tr tdb String 1.2.3.4.5.6 /b/td tdimg src=pics/green.gif alt=OK/td tr One way to solve this would be to read lines from the file and save chunks of N lines

Re: Regex Multi line match

2005-03-08 Thread Dave Gray
Something like (untested): my (@lines, $num) = ((), 4); while (INPUT) { push @lines, $_; shift @lines if @lines == $num+1; print 'lines '.($.-$num+1).' to '.($.). match\n if join('',@lines) =~ /regex goes here/; } That assumes that the pattern being searched for

Re: Regex Multi line match

2005-03-08 Thread John W. Krahn
Dave Gray wrote: This is the multi line pattern in which I wish to match: tr tdb String 1.2.3.4.5.6 /b/td tdimg src=pics/green.gif alt=OK/td tr One way to solve this would be to read lines from the file and save chunks of N lines (4 in this case) in a temp variable. Then your regex would operate

Re: Regex Multi line match

2005-03-08 Thread Jay Savage
On Tue, 8 Mar 2005 15:26:28 -0500, Dave Gray [EMAIL PROTECTED] wrote: Something like (untested): my (@lines, $num) = ((), 4); while (INPUT) { push @lines, $_; shift @lines if @lines == $num+1; print 'lines '.($.-$num+1).' to '.($.). match\n if join('',@lines) =~

Re: Regex Multi line match

2005-03-08 Thread Dave Gray
my (@lines, $num) = ((), 4); You are assigning the list ((), 4) to @lines and nothing to $num. Perhaps you meant: my ( $num, @lines ) = ( 4, () ); Or simply: my ( $num, @lines ) = 4; Indeed, good catch. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,