0

Hi all,
I am dealing a small issue. I am missing something silly :). My need is that I want the entire lines between <TABLE> </TABLE> with no modifications.

<?php

$some_string = <<<STR
<HR noShade size=2>
<TABLE  BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR="" >
<TR BGCOLOR="c1ffcc">
<TH ALIGN="LEFT" COLSPAN=22>
<font face="Arial,Helvetica,Geneva,Swiss,Verdana" size="2" color="black">Baseline Comparison for Request Id: </font></TH>
</TR>
<TR BGCOLOR="lightblue">
<TH COLSPAN=1>
</TH>
</TABLE>
</body>
</html>
STR;

$match = preg_match('`<TABLE  BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR="" > (.*)</TABLE>`i', $some_string,$table);

echo $match;

print_r($table);

But this code doesn't fetch me the desired output. Any help will be highly appreciated.

2
Contributors
1
Reply
3
Views
5 Years
Discussion Span
Last Post by pritaeas
0

What is the output you get, and what is the output you want ?

If you look at the manual, you can see that $match is an integer. If you want to get the text, you'll need to use $table[1] (assuming your regex is correct).

Edited by pritaeas: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.