πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.perl
4 messages
4 total messages Started by Michael Lepine Wed, 18 Mar 1998 17:34
pattern matching problem
#1129
Author: Michael Lepine
Date: Wed, 18 Mar 1998 17:34
32 lines
1944 bytes
I am using the following code to limit an archive web site so that it
only contains the ten most recent feature entries.

 while($_ = <IN>) {
   if ($entry_area_flag) {
        /^.*<li>.*?/i && do {  # count list items in archive
                                $archive_entries++;
                                if ($archive_entries >= 10) {
                                        next; # if 10 list items, don't
print
                                }
                         }
        /^.*</ul>.*?/i && do {  # end of archive list entries
                                undef $entry_area_flag;
                                print "Entries: $archive_entries\n" if
$DEBUG;
                          }
   }
    print FILE $_;
    /^.*NEW_ARCHIVE_ENTRIES.*/ && do {
                                     print FILE $New_Entry;
                                     $archive_entries++;
                                     $entry_area_flag = 1;
                                  }
 }

For some reason I get a syntax error with the second pattern matching
sequence in the code ( /^.*</ul>.*?/ ). No matter what I replace the
search pattern with, I get an error. Can someone please help me figure
out a way around this?

Mike
Re: pattern matching problem
#1130
Author: Tomasz Sulej
Date: Thu, 19 Mar 1998 09:26
16 lines
1086 bytes
Michael Lepine <mlepine@bellsouth.net> wrote:
[...]
> For some reason I get a syntax error with the second pattern matching
> sequence in the code ( /^.*</ul>.*?/ ). No matter what I replace the
			three slashes

> search pattern with, I get an error. Can someone please help me figure
> out a way around this?

> Mike

-- 

Tomasz Sulej - FTiMS PW
e-mail : tay@green2.mikrus.pw.edu.pl (DziaΕ‚a czasami)
e-mail : tay@prioris.im.pw.edu.pl
Re: pattern matching problem
#1131
Author: rafal wiosna
Date: Thu, 19 Mar 1998 12:33
12 lines
1082 bytes
* Michael Lepine <mlepine@bellsouth.net> wrote:

 >         /^.*</ul>.*?/i && do {  # end of archive list entries

	<\/ul>


-- 
___________________________________________________________________________ 
rafal wiosna * http://raf.polbox.pl/ * Fidonet 2:480/33 * "In ARP we trust"
"Ask stupid ASCII get stupid ANSI"  B.O.F.P.  free.polbox.pl administrator
PGP public key available at http://www.pl.pgp.net/pgpnet/pks/ ("rafamiga")
Re: pattern matching problem
#1132
Author: Marek Matula
Date: Fri, 20 Mar 1998 16:50
17 lines
1041 bytes
On Wed, 18 Mar 1998 17:34:36 GMT, Michael Lepine
<mlepine@bellsouth.net> wrote:

>
>For some reason I get a syntax error with the second pattern matching
>sequence in the code ( /^.*</ul>.*?/ ). No matter what I replace the
>search pattern with, I get an error. Can someone please help me figure
>out a way around this?
>
Guess, you should precede the slash with the backslash. Try this:
 /^.*<\/ul>.*?/

--
Marek Matula
marekm@zeus.polsl.gliwice.pl
http://www.polsl.gliwice.pl/~marekm
ICQ UIN: 3888637
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads