file clipper

P

pippolino

i want to write a clipper which scans a file for each occurence of a regexp
like /<div>.*<\/div>/ and put it on a scalar concatenating it with .= or simply
prints it out... It seems simple but the only ways i know to access file is line
by line or char by char so i have to scan first for <div> and use another regexp
to look for the </div> which is on another line... is there a way to do it with
a single regexp, or, i don't think it will be a good solutions, scan the whole
file at the same time?!
thanks everyone who wants to help me!
 
A

Anno Siegel

pippolino said:
i want to write a clipper which scans a file for each occurence of a regexp
like /<div>.*<\/div>/ and put it on a scalar concatenating it with .= or simply
prints it out... It seems simple but the only ways i know to access file is line
by line or char by char so i have to scan first for <div> and use another regexp
to look for the </div> which is on another line... is there a way to do it with
a single regexp, or, i don't think it will be a good solutions, scan the whole
file at the same time?!
thanks everyone who wants to help me!

That is only the beginning of the difficulties. Others are nested tags,
tags appearing in comments, and some more. Consider one of the
HTML-parsing modules.

Anno
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top