moonlord has asked for the wisdom of the Perl Monks concerning the following question:
and I want to find certain tags using this code snippet, and output a qif file. The problem I'm having is in matching the start and end tags.<tr><td bgcolor='#DCDCDC' align='left' width='100'><font face='arial,h +elvetica' size='-2'> 28 Jun 2001</font></td><td bgcolor='#DCDCDC +' + align='left' width='300'><font face='arial,helvetica' size='-2'>&nbs +p +;HMV UK LTD NOTTINGHAM GB</font></td><td bgcolor='#DC +D +CDC' align='right' width='75'><font face='arial,helvetica' size='-2'> +& +pound;10.99 </font></td></tr><tr><td bgcolor='#DCDCDC' align='l +e +ft' width='100'><font face='arial,helvetica' size='-2'> 28 Jun 2 +0 +01</font></td><td bgcolor='#DCDCDC' align='left' width='300'><font fa +c +e='arial,helvetica' size='-2'> MARKS SPENCER NOTTINGHA +M + 06 GB</font></td><td bgcolor='#DCDCDC' align='right' width='75'><fon +t + face='arial,helvetica' size
It never seems to match the start tag, and if I change the start tag to something simpler like$start="<td bgcolor=\'#DCDCDC\' align=\'left\' width=\'300\'><font fac +e='arial,helvetica' size='-2'> "; $end="</font></td>"; while (<>) { if (/$start(.*?)$end/g) { print "\n\n\nDOODAH:".$1."\n"; } }
then the perl never seems to stop when it hits something that matches the $end var. I've been going round and round this and I just can't figure it out, so any advice would be greatly appreciated. Cheers moonlord$start="<td bgcolor";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: html tag matching confusion
by rob_au (Abbot) on Nov 25, 2001 at 05:47 UTC | |
|
Re: html tag matching confusion
by jarich (Curate) on Nov 25, 2001 at 08:33 UTC | |
|
Re: html tag matching confusion
by demerphq (Chancellor) on Nov 25, 2001 at 16:54 UTC | |
|
Re: html tag matching confusion
by Rich36 (Chaplain) on Nov 25, 2001 at 05:47 UTC | |
|
Re: html tag matching confusion
by mattr (Curate) on Nov 25, 2001 at 12:36 UTC | |
by jarich (Curate) on Nov 25, 2001 at 14:26 UTC |