Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

devnul's scratchpad

by devnul (Monk)
on Jan 07, 2005 at 22:14 UTC ( #420412=scratchpad: print w/replies, xml ) Need Help??

I am having a problem with the following, $match2 works, $match does not. Any ideas?

my $rec = ' <td align="center" valign="middle" class="pdad"> extract this, please! </td> <td width="2"><img src="../images/spacer.gif" width="2" height= +"1" /></TD> </tr> </table> </td> <td width="1" bgcolor="#dddddd"><img src="../images/spacer.gif" wi +dth="1" height="1" /></td> <td bgcolor="#FFFFF7" align="center" valign="TOP" nowrap> <table align="center" cellspacing="0" cellpadding="0" border="0"> <tr> <td width="2"><img src="../images/spacer.gif" width="2" height= +"1" /></TD> <td class="pdad">$689,900</td>'; my $tag = '(?:<[^>]*>\s*)'; my $match = qr/$tag(.*?)$tag{17}\$(.*?)<\/td>/; print "MATCH: $match\n"; if($rec =~ m|$match|is) { print "YAY!!! $1, $2\n"; } my $match2 = "$tag(.*?)$tag" . '{17}\$(.*?)</td>'; print "MATCH2: $match2\n"; if($rec =~ m|$match2|is) { print "YAY2!!! $1, $2\n"; }
Output is:
MATCH: (?-xism:(?:<[^>]*>\s*)(.*?)(?:<[^>]*>\s*){17}\$(.*?)</td>) MATCH2: (?:<[^>]*>\s*)(.*?)(?:<[^>]*>\s*){17}\$(.*?)</td> YAY2!!! extract this, please! , 689,900
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2023-12-06 11:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (30 votes). Check out past polls.

    Notices?