multiline pattern matching from file

G

Giulio

hi,

I am developing a script for extracting data from some webpages I got
with wget.
I am using pattern matching to extract a list of items from the file.
Each item is composed by several properties, contained on different
lines of the page, which must be kept together (they're of course in
order and there's a multiline pattern to find them out one by one).

so far I arrived to the code (at the end of the msg) that matches
greatly, but data on single lines of the pages.

how can I do this pattern matching from the file and obtain the full
multiline pattern?

thanx
G

------------------
open (FILE, "<$file") || die("error in opening file");

while ($f = <FILE>) {
if ($f =~ /^.*<a href="\/photos\/(.*)\/(.*)\/" title="(.*)">/ ) {
$userName = $1;
$imageCode = $2;
------------------
 
T

Tad McClellan

Giulio said:
Each item is composed by several properties, contained on different
lines of the page,

how can I do this pattern matching from the file and obtain the full
multiline pattern?


I'd start with the official answer to your Frequently Asked Question:

perldoc -q match

I’m having trouble matching over more than one line. What’s wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top