Here is my code:
<?php
$text='<td valign="top">text</td><td>more text</td>';
preg_match('/<td valign="?top"?>.*<\/td>)/s', $text, $matches);
?>
$matches[0]
should return<td valign="top">text</td>
but it returns <td valign="top">text</td><td>more text</td>
. Why?