Resize width and height of images - php

I have content stored in mysql, as following:
<table width="450" cellspacing="1" cellpadding="1" border="1">
<tbody>
<tr>
<td><img width="513" height="680" align="left" alt=" src="/userfiles/image/pic.jpg" /></td>
<td><img width="315" height="700" align="left" alt=" src="/userfiles/image/DSC_0389.JPG" /></td>
<td><img width="580" height="320" align="left" alt=" src="/userfiles/image/ktxh.jpg" /></td>
</tr>
</tbody>
</table>
When I load from db, PHP and display in html by PHP, there is no problem.
Now, I want all images, be displayed by fixed width and height as 200 X 200 AND TABLE BORDER = '0'
<table width="200" cellspacing="1" cellpadding="1" border="0">
<tbody>
<tr>
<td><img width="200" height="200" align="left" alt=" src="/userfiles/image/pic.jpg" /></td>
<td><img width="200" height="200" align="left" alt=" src="/userfiles/image/DSC_0389.JPG" /></td>
<td><img width="200" height="200" align="left" alt=" src="/userfiles/image/ktxh.jpg" /></td>
</tr>
</tbody>
</table>
How do I solve this problem?

Replace with this code and css
<style>
.cstm
{
width:200px;
height:200px
}
table
{
border:0
}
</style>
<table width="200" cellspacing="1" cellpadding="1" border="0">
<tbody>
<tr>
<td><img class="cstm" align="left" alt=" src="/userfiles/image/pic.jpg" /></td>
<td><img class="cstm" align="left" alt=" src="/userfiles/image/DSC_0389.JPG" /></td>
<td><img class="cstm" align="left" alt=" src="/userfiles/image/ktxh.jpg" /></td>
</tr>
</tbody>
</table>

As you mention the $content is dynamic, can you try adding the style to the table as such:
<style>
table td>img
{
width:200px;
height:200px
}
</style>

Related

How to insert Google Ads in left and right sidebar?

I want on my site to insert Google Ads on left and right sidebar, but I don't know how to create sidebars.
This is code from my header.php code that i have currently:
<?php
include "config.php";
?>
<html>
<head><meta name="adtictac-site-verification"
content="1qvt6zbzk026xfomo6gxbxxhjk9t96obv58gpcv3n9ver69s0"><meta
name="clckd" content="273a893ce34e0acd4ba2655313b5f902" />
<title><?php echo $sitename; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#2C60A9" leftmargin="1" topmargin="0" marginwidth="0"
marginheight="0">
<table width="777" border="2" bgcolor="#ffffff" align="center"
cellpadding="0" cellspacing="0" class="border">
<tr>
<td><img src="images/header.jpg" width="777" height="210" alt=""></td>
</tr>
<tr>
<td background="images/bg.jpg"><table width="100%" border="0"
cellspacing="0" cellpadding="0">
<tr>
<td width="30%"><img src="images/links.jpg" width="231" height="17"
alt=""></td>
<td width="7%"><A href="index.php"><img src="images/home.jpg" width="54"
height="17" alt="" border="0"></a></td>
<td width="11%"><A href="join.php"><img src="images/register.jpg"
width="83" height="17" alt="" border="0"></a></td>
<td width="7%"><A href="faq.php"><img src="images/faq.jpg" width="54"
height="17" alt="" border="0"></a></td>
<td width="12%"><A href="contactus.php"><img src="images/contact-us.jpg"
width="98" height="17" alt="" border="0"></a></td>
<td width="12%"><A href="advertise.php"><img src="images/advertise.jpg"
width="92" height="17" alt="" border="0"></a></td>
<td width="21%"><A href="login.php"><img src="images/login.jpg"
width="49" height="17" alt="" border="0"></a></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td class="bodytext"> </td>
<td> </td>
</tr>
<tr>
<td width="7%"> </td>
<td width="91%" class="bodytext"><p align="justify">
<?php
include "config.php";
$rs=mysql_query("select ID,BannerURL from bannersads where remaining>0 and
approved=1 and adtype=1 order by rand() limit 0,1");
while($arr=mysql_fetch_array($rs)) {
echo "<br><center><a href=$siteurl/tr.php?id=$arr[0] target=_blank><img
src=$arr[1] width=468 height=60 border=0></a><br></center><br>";
$rsu=mysql_query("update bannersads set remaining=remaining-1 where
ID=$arr[0]");
}
?>
So can someone share some tips how to create sidebars where need to create placed like shown in image? I tryed inserting this:
<div class="google">
// Google Code here
</div>
and this CSS:
.google {
margin-left:-250px;
}
but looks like broke my content in my homepage.
.google {
left: 250px;
}
Also create a container and give it width in px, not %.
Let me hope that will solve your problem.

DataTable plugin not working with dynamically generated php data?

DataTable plugin not working with dynamically generated php data ?
I am using data table in to display a dynamic table. But its not working.
I tried to use static table its working I don't understand the problem
Here is my HTML Table and js script.
Can anyone solve the issue.
$(document).ready(function () {
$('#myTable').dataTable();
});
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" id="myTable">
<thead>
<tr>
<th width="100" height="30" align="left" bordercolor="#999999" bgcolor="#d3d3d3">Client Name</th>
<th width="100" height="30"align="left" bordercolor="#999999" bgcolor="#d3d3d3">EPIC ID</th>
<th width="100" height="30" align="left" bordercolor="#999999" bgcolor="#d3d3d3">Project Name</th>
<th width="100" height="30"align="left" bordercolor="#999999" bgcolor="#d3d3d3">Category</th>
<th width="100" height="30" align="left" bordercolor="#999999" bgcolor="#d3d3d3">Epic Status</th>
<th width="150" height="30" align="left" bordercolor="#999999" bgcolor="#d3d3d3">Total Estimated Hours</th>
<th width="150" height="30" align="left" bordercolor="#999999" bgcolor="#d3d3d3">Total Time Spent</th>
<th width="150" height="30" align="left" bordercolor="#999999" bgcolor="#d3d3d3" >% Hours Burned</th>
<th width="150" height="30" align="left" bordercolor="#000000" bgcolor="#d3d3d3">% Project Complete</th>
<th width="150" height="30" align="left" bordercolor="#000000" bgcolor="#d3d3d3">Action Status</th>
</tr>
</thead>
<tbody>
<tr <?php if($cnt%2==0){echo "bordercolor='#FFFFFF' bgcolor='#FFFFFF'";}else{echo "bordercolor='#999999' bgcolor='#FFFFFF'";}?>>
<td align="left" width="100" height="30"><?php echo "$ClientName";?></td>
<td align="left" width="100" height="30">
<?php
echo form_open('Riskreport',array('name'=>'s2frm'.$cnt,'target'=>'_blank'));?>
<?php echo "$EPICID";?>
<input type="hidden" name="epickeyid" value="<?php echo "$EPICID";?>" />
<?php echo $formbuild;?>
</form>
</td>
<td align="left" width="100" height="30"><?php echo "$ProjectName";?></td>
<td align="left" width="100" height="30"><?php echo "$Category";?></td>
<td align="left" width="100" height="30"><?php echo "$epic_status";?></td>
<td align="left" width="150" height="30"><?php echo "$TotalEstimatedHours";?></td>
<td align="left" width="150" height="30"><?php echo "$TotalTimeSpentinHours";?></td>
<td align="left" width="150" height="30" <?php if(($variance2>0)&&($variance2<=100)){echo "bgcolor='#92d050'";}else if(($variance2>100)&&($variance2<=120)){echo "bgcolor='#FFC200'";}else if($variance2>120){echo "bgcolor='#ff0000'";}else{echo "bgcolor='#FFFFFF'";}?>><?php echo $variance2prcnt;?></td>
<td align="left" width="150" height="30">
<?php
$PrjtCompleteprcnt=$ops1->getprjctdone($EPICID);
echo $PrjtCompleteprcnt;
?>
</td>
<td align="CENTER" width="150" height="30"><?php echo "$ActionStatus";?></td>
</tr>
</tbody>
</table>

Cleaning Emails collected from IMAP for insertion to a database

I'm in the process of creating a script for our internal customer support system. I want to collect emails from our IMAP inbox (hosted on Gmail) and parse the emails into the database.
What is the best way to clean frames, badly coded tags, and messy formatting so the result is a clean text with minimal formatting?
I'm aware Regular Expressions will most likely play heavily, but I want to know if this functionality exists in another library somewhere that I'm missing.
Edit: More specifically what needs removed:
All inline CSS/Styling, All HTML except simple formatting like Bold, Underline, and Italics.
Here's an email I'm using as a test case, It's a fairly beefy spam email I got from ZoneAlarm, It's got a bit of everything.
<td>
<br>
<br>
<table align="center" bgcolor="#749FD0" border="0" cellpadding="0" cellspacing="0" style="font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:16px;color:#555555" valign="top" width="700">
<tbody>
<tr>
<td>
<table align="center" border="0" cellpadding="0" cellspacing="0" valign="top" width="680">
<tbody>
<tr>
<td height="10">
<img border="0" height="1" src="http://download.zonealarm.com/bin/images/email/socialguard/spacer.gif" style="display: block; max-width: 2880px;" width="1"></td>
</tr>
</tbody>
</table>
<table align="center" border="0" cellpadding="0" cellspacing="0" valign="top" width="680">
<tbody>
<tr>
<td height="10" width="10">
<img border="0" height="10" src="http://www.zonealarm.com/email/campaigns/2013/2013_06_SummerSale/nw.png" style="display: block; max-width: 2880px;" width="10"></td>
<td bgcolor="#E3ECEC" height="10" width="660">
<img alt="ZoneAlarm by Check Point Software Technologies LTD." border="0" src="http://www.zonealarm.com/email/campaigns/2013/2013_05_MemorialDay/za_transparent.png" width="120" style="display: block; max-width: 2880px;" title="ZoneAlarm by Check Point Software Technologies LTD."></td>
<td align="right" style="font-family:Arial,Helvetica,sans-serif" width="150">
<span style="color:#999999;font-size:12px">Connect with ZoneAlarm</span></td>
<td align="right" valign="middle" width="125">
<img alt="ZoneAlarm Facebook" border="0" src="http://www.zonealarm.com/email/campaigns/2013/2013_05_MemorialDay/facebook.png" width="22" title="ZoneAlarm Facebook" style="max-width: 2880px;"> <img alt="ZoneAlarm Twitter" border="0" width="22" src="http://www.zonealarm.com/email/campaigns/2013/2013_05_MemorialDay/twitter.png" title="ZoneAlarm Twitter" style="max-width: 2880px;"> <img alt="ZoneAlarm YouTube" border="0" src="http://www.zonealarm.com/email/campaigns/2013/2013_05_MemorialDay/youtube.png" title="ZoneAlarm YouTube" height="22" style="max-width: 2880px;"><img border="0" height="15" src="http://download.zonealarm.com/bin/images/email/socialguard/spacer.gif" width="10" style="max-width: 2880px;"></td>
<td bgcolor="#E3ECEC" rowspan="6" align="center" valign="top" width="1">
<img align="right" height="32" src="http://download.zonealarm.com/bin/images/emails/welcome/borderx1.png" width="1" style="max-width: 2880px;">
</td>
</tr>
</tbody>
</table>
<table align="center" border="0" cellpadding="0" cellspacing="0" valign="top" width="680">
<tbody>
<tr>
<td height="10" width="10">
<img border="0" height="10" src="http://www.zonealarm.com/email/campaigns/2013/2013_06_SummerSale/sw.png" style="display: block; max-width: 2880px;" width="10"></td>
<td bgcolor="#E3ECEC" height="10" width="660">
You can use HTML Purifier for this, see: http://htmlpurifier.org/

Regex to read Table Rows contents in Array - PHP

Is there any Regex to Read the <td> contents from the following Table, note that there are many similar tables so i want only to read the following table contents.
I want to READ data from 3,4,5 TD from all <TR>
My regex looks like following but doesnt work
$match = preg_replace('~<td width="80" bgcolor="#F3F3E4" align="left"> <a onmouseout="ChangeImage(AE1,1)" onmouseover="ChangeImage(AE1,0)" href="/charts/livegold.html">GOLD</a></td>#[a-z0-9]{6}~i','',$match[3]);
echo '<table><tr>' . $match . '</tr></table>';
the table is as follows
<table width="540" cellspacing="1" cellpadding="0" border="0" align="center">
<tbody><tr>
<td width="16" bgcolor="#000000" align="center"> </td>
<td width="80" bgcolor="#000000" align="center"><font size="1" face="Arial, Helvetica, sans-serif" color="#FFFFFF">www.kitco.com</font></td>
<td width="369" bgcolor="#000000" align="center" colspan="5"><p class="white">The World Spot Price - Asia/Europe/NY markets</p></td>
<td width="73" bgcolor="#000000" align="right"><img width="39" vspace="0" hspace="0" height="17" border="0" alt="light" src="/images/lightgreen.gif"></td>
</tr>
<tr>
<td width="16" bgcolor="#000000" align="center"> </td>
<td width="522" bgcolor="#F3F3E4" align="center" colspan="7"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><b><font color="GREEN">MARKET IS OPEN</font><br>(Will close in 17 hrs. 41 mins.)<!-- 1486.00--></b></font></td>
</tr>
<tr bgcolor="#F3F3E4">
<td width="16" bgcolor="#000000" align="center"> </td>
<td width="80" bgcolor="#CCCC99" align="center">Metals</td>
<td width="80" bgcolor="#CCCC99" align="center">Date</td>
<td width="80" bgcolor="#CCCC99" align="center">Time (EST)</td>
<td width="68" bgcolor="#CCCC99" align="center">Bid</td>
<td width="68" bgcolor="#CCCC99" align="center">Ask</td>
<td width="146" bgcolor="#CCCC99" align="center" colspan="2">Change from NY Close</td>
</tr>
<tr bgcolor="#F3F3E4">
<td width="16" bgcolor="#000000" align="center"><a onmouseout="ChangeImage('AE1','1')" onmouseover="ChangeImage('AE1','0')" href="/charts/livegold.html"><img width="16" vspace="0" hspace="0" height="13" border="0" alt="Gold Charts" name="AE1" src="http://www.kitco.com/images/graph_down.gif"></a></td>
<td width="80" bgcolor="#F3F3E4" align="left"> <a onmouseout="ChangeImage('AE1','1')" onmouseover="ChangeImage('AE1','0')" href="/charts/livegold.html">GOLD</a></td>
<td width="80" align="center">06/04/2013</td>
<td width="80" align="center">23:34</td>
<td width="68" align="center">1405.50</td>
<td width="68" align="center">1406.50</td>
<td width="73" align="center"><p class="spotgreen">+5.50</p></td>
<td width="73" align="center"><p class="spotgreen">+0.39%</p></td>
</tr>
<tr bgcolor="#F3F3E4">
<td width="16" bgcolor="#000000" align="center"><a onmouseout="ChangeImage('AE2','1')" onmouseover="ChangeImage('AE2','0')" href="/charts/livesilver.html"><img width="16" vspace="0" hspace="0" height="13" border="0" alt="Silver Charts" name="AE2" src="http://www.kitco.com/images/graph_down.gif"></a></td>
<td width="80" align="left"> <a onmouseout="ChangeImage('AE2','1')" onmouseover="ChangeImage('AE2','0')" href="/charts/livesilver.html">SILVER</a></td>
<td width="80" align="center">06/04/2013</td>
<td width="80" align="center">23:34</td>
<td width="68" align="center">22.59</td>
<td width="68" align="center">22.69</td>
<td width="73" align="center"><p class="spotgreen">+0.05</p></td>
<td width="73" align="center"><p class="spotgreen">+0.20%</p></td>
</tr>
<tr bgcolor="#F3F3E4">
<td width="16" bgcolor="#000000" align="center"><a onmouseout="ChangeImage('AE3','1')" onmouseover="ChangeImage('AE3','0')" href="/charts/liveplatinum.html"><img width="16" vspace="0" hspace="0" height="13" border="0" alt="Platinum Charts" name="AE3" src="http://www.kitco.com/images/graph_down.gif"></a></td>
<td width="80" align="left"><p> <a onmouseout="ChangeImage('AE3','1')" onmouseover="ChangeImage('AE3','0')" href="/charts/liveplatinum.html">PLATINUM</a></p></td>
<td width="80" align="center">06/04/2013</td>
<td width="80" align="center">23:34</td>
<td width="68" align="center">1501.00</td>
<td width="68" align="center">1509.00</td>
<td width="73" align="center"><p class="spotgreen">+9.00</p></td>
<td width="73" align="center"><p class="spotgreen">+0.60%</p></td>
</tr>
<tr bgcolor="#F3F3E4">
<td width="16" bgcolor="#000000" align="center"><a onmouseout="ChangeImage('AE4','1')" onmouseover="ChangeImage('AE4','0')" href="/charts/livepalladium.html"><img width="16" vspace="0" hspace="0" height="13" border="0" alt="Palladium Charts" name="AE4" src="http://www.kitco.com/images/graph_down.gif"></a></td>
<td width="80" align="left"> <a onmouseout="ChangeImage('AE4','1')" onmouseover="ChangeImage('AE4','0')" href="/charts/livepalladium.html">PALLADIUM</a></td>
<td width="80" align="center">06/04/2013</td>
<td width="80" align="center">23:25</td>
<td width="68" align="center">755.00</td>
<td width="68" align="center">761.00</td>
<td width="73" align="center"><p class="spotgreen">+6.00</p></td>
<td width="73" align="center"><p class="spotgreen">+0.80%</p></td>
</tr>
</tbody></table>
Here is the data i want to Extract
ok here is the solution with Regex:
$patt = "/<td[^>]*width=['\"]68['\"][^>]*>([0-9\.]+)<\/td>\s*<td[^>]*width=['\"]68['\"][^>]*>([0-9\.]+)<\/td>/i";
if(preg_match_all($patt, $html, $matches))
{
//print all records
//print_r($matches);
for($i=0; $i<count($matches[1]); $i++)
{
echo "Bid: ".$matches[1][$i].", Ask: ".$matches[2][$i]."\n";
}
}
You can use some HTML parser. For PHP there is one http://simplehtmldom.sourceforge.net/
Once the DOM has been loaded into library, get through the TABLE element and iterate through each TR element.

PHP Trying to get string from a table cell with regular expressions

I have the following site and I want with regular expressions to get the text between the following tags
<td colspan="2" align="left" valign="top" bgcolor="#FBFAF4"> ..... </td>
I am trying with the following however it returns an empty array of $matches.
preg_match_all("/<td(.*) bgcolor=\"#FBFAF4\"\>(.*)\<\/td>/",$old_filecontents,$matches);
Which is the correct pattern for this?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Exotiq - Ðñïúüíôá</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-7"> <link href="Styles.css" rel="stylesheet" type="text/css"> <link href="stylesheets/Styles.css" rel="stylesheet" type="text/css"> <script src="scripts/PopBox.js" type="text/javascript"></script> <script type="text/javascript"> popBoxWaitImage.src = "images/spinner40.gif"; popBoxRevertImage = "images/magminus.gif"; popBoxPopImage = "images/magplus.gif"; </script> <script type="text/javascript"> AC_FL_RunContent('codebase', 'http://download.macromedia.com/pub/shockwave/ cabs/flash/swflash.cab#version=9,0,28,0', 'width','675','height','445','title','Morpork', 'src','assets/flash/morepork','loop', 'false','quality','high','pluginspage', 'http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash', 'wmode','transparent','movie','assets/flash/morepork'); </script> </head> <body background="images/fonto2.jpg" topmargin="0"> <table width="948" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><table width="948" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="24"> </td> <td height="150" colspan="3"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="900" height="150"> <param name="movie" value="flash/top02.swf"> <param name="quality" value="high"> <param name="wmode" value="transparent"> <embed src="flash/top02.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="900" height="150"></embed></object></td> <td width="24" height="150"> </td> </tr> <tr> <td height="31" colspan="5" valign="middle"> <div align="center"> <script src="menu/xaramenu.js"></script> <script Webstyle4 src="menu/menu_.js"></script> </div></td> </tr> <tr> <td width="24"> </td> <td width="200" valign="top" background="images/GreenFasa.jpg"> <br> <table width="180" border="0" align="center" cellpadding="0" cellspacing="1"> <tr> <td height="25" class="styles"> Makuti<br> <hr> </td> </tr> <tr> <td height="25" class="styles"> Fun Palm<br> <hr> </td> </tr> <tr> <td height="25" class="styles"> Alang-Alang<br> <hr> </td> </tr> <tr> <td height="25" class="styles"> Thatch<br> <hr> </td> </tr> <tr> <td height="25" class="styles"> <strong>Abaca</strong><br> <hr> </td> </tr> <tr> <td height="25" class="styles"> </td> </tr> </table></td> <td colspan="2" align="left" valign="top" bgcolor="#FBFAF4"> <div align="left"> <table width="680" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="600" height="40" class="titles">ÊáôáóêåõÝò - ÏìðñÝëåò - Abaca</td> <td width="50" align="right" valign="middle" class="titles"> <div align="right"><img src="images/uk-flag.jpg" width="30" height="17" border="0"></div></td> </tr> <tr> <td colspan="2" class="body"><p>Ç ïìðñÝëá <strong>Abaca</strong> Ýñ÷åôáé ùò Üîéïò áíôéêáôáóôÜôçò ôçò ïìðñÝëáò Rattan ðïõ åðß 15 ÷ñüíéá óôïëßæåé ôéò åëëçíéêÝò ðáñáëßåò. Ôï <strong>Abaca</strong> åßíáé Ýíá öõóéêü õëéêü ðéï <strong>áíèåêôéêü</strong> êáé ðéï üìïñöï áðü ôï Rattan. <br> Ðáñáäßäåôáé ìå <strong>îýëéíï êïñìü åìðïôéóìïý</strong> Ö8åê.<br> <br> </p> <table width="680" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="340" height="150" valign="middle"> <div align="left"><img src="images/Manufactures/Umbrelas/Abaca/AbacaUmbrela.jpg" width="328" height="500"></div></td> <td width="340" height="150" valign="bottom" class="body"> <table width="340" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="170" height="130"> <div align="center"><img src="images/Manufactures/Umbrelas/Abaca/1_Abaca02_s.jpg" width="152" height="101" class="PopBoxImageSmall" onclick="Pop (this,50,'PopBoxImageLarge');" title="ÌåãÝèõíóç" pbsrc="images/Manufactures/Umbrelas/Abaca/1_Abaca02.jpg" pbCaption="Abaca - ÏìðñÝëá ðáñáëßáò" popBoxCaptionBelow="true" /></div></td> <td width="170" height="130"> <div align="center"><img src="images/Manufactures/Umbrelas/Abaca/2_Abaca03_s.jpg" width="150" height="112" class="PopBoxImageSmall" onclick="Pop (this,50,'PopBoxImageLarge');" title="ÌåãÝèõíóç" pbsrc="images/Manufactures/Umbrelas/Abaca/2_Abaca03.jpg" pbCaption="Abaca - ÏìðñÝëá ðáñáëßáò" popBoxCaptionBelow="true" /></div></td> </tr> <tr> <td width="170" height="130"> <div align="center"><img src="images/Manufactures/Umbrelas/Abaca/3_Abaca01_s.jpg" width="150" height="112" class="PopBoxImageSmall" onclick="Pop (this,50,'PopBoxImageLarge');" title="ÌåãÝèõíóç" pbsrc="images/Manufactures/Umbrelas/Abaca/3_Abaca01.jpg" pbCaption="Abaca - ÏìðñÝëá ðáñáëßáò" popBoxCaptionBelow="true" /></div></td> <td width="170" height="130"> <div align="center"></div></td> </tr> <tr> <td width="170" height="130"> <div align="center"></div></td> <td width="170" height="130"> <div align="center"></div></td> </tr> <tr> <td width="170" height="130"> <div align="center"></div></td> <td width="170" height="130"> <div align="center"></div></td> </tr> </table></td> </tr> <tr> <td width="340" height="50" valign="top"> <p align="center"> </p></td> <td width="340" height="50" valign="top"> <div align="center" class="perigrafes">ÊëéêÜñåôáé ðÜíù óôéò öùôïãñáößåò ãéá ìåãÝèõíóç</div></td> </tr> <tr> <td width="340" valign="bottom"> <div align="center"> </div></td> <td width="340" valign="bottom"> <p align="center"> </p></td> </tr> <tr> <td width="340" valign="top"> <div align="center"></div></td> <td width="340" valign="top"> <p align="center"> </p></td> </tr> <tr> <td height="20" colspan="2" valign="top"> </td> </tr> </table></td> </tr> </table> <font color="#FFFFFF"></font></div></td> <td width="24" height="420"> </td> </tr> <tr> <td width="24"> </td> <td width="200"> </td> <td width="600"> </td> <td width="100"> </td> <td width="24"> </td> </tr> </table></td> </tr> <tr> <td height="22"><table width="900" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#007F3E"> <tr> <td height="25"> <div align="center" class="styles">All rights reserved ® Designed by CONTINENTAL ADVERTISING </div></td> </tr> </table></td> </tr> </table> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-12742174-1"); pageTracker._trackPageview(); } catch(err) {}</script> </body> </html>
Given that the cell you're talking about contains HTML, another table in fact, you can't do traditional termination checking ... or you'll get the content between the cell opening and the first </td> you find. Plus '.' isn't multi-line friendly, so unless your cell opens and terminates on the same line, you'll get no matches.
I'd say don't use regular expressions for this. Try an XML parser.
If you were just getting plain text, that'd be fine, but because you're returning HTML which contains your terminator, you'll need to use a parser with some kind of DOM depth awareness ... ... or find a way to count terminators in regex.

Categories