Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/perl/bin/perl use CGI qw(:header); use CGI::Carp qw(fatalsToBrowser); use CGI qw/:standard/; use strict; print header(); use warnings 'all'; my $directory = "/test"; my $new_file = "$directory/test.txt"; my $out_put; open(FH,'<',$new_file) || die $!; my @test = <FH>; foreach my $line (@test) { $line =~ /<!--\s+\d+nd movie -->\s*(.*?)\s*<!--\s+\/\d+nd movie -- +>/sgi; $out_put = $1; print $out_put; } close(FH);
<!-- 3nd table --><table cellpadding="0" cellspacing="0" border="0"><t +r><td>Test Line no end of line.</td</tr></table><!-- /3nd table --> <!-- 1nd --> <table cellpadding="2" cellspacing="0" border="0"><tr><td><font color= +red>Test Line</font></td></tr></table> <!-- /1nd table --> <!-- 4nd table --><table cellpadding="0" cellspacing="0" border="1"><t +r><td><font color=navy>Test Line no end of line.</font></td></tr></ta +ble><!-- /4nd table --> <!-- 2nd table --> <table cellpadding="0" cellspacing="0" border="0"><tr><td>Test Line no + end of line.</td</tr></table> <!-- /2nd table -->
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular Expression Matching Issue
by Corion (Patriarch) on Jan 02, 2008 at 19:12 UTC | |
by Anonymous Monk on Jan 02, 2008 at 19:41 UTC | |
|
Re: Regular Expression Matching Issue
by toolic (Bishop) on Jan 02, 2008 at 19:12 UTC | |
by Anonymous Monk on Jan 02, 2008 at 19:39 UTC | |
|
Re: Regular Expression Matching Issue
by olus (Curate) on Jan 02, 2008 at 21:38 UTC | |
by Punitha (Priest) on Jan 03, 2008 at 04:06 UTC | |
by Anonymous Monk on Jan 03, 2008 at 15:08 UTC |