Only difference is a parentheses around the first \s, but i thought these two were the same:
'\s*' = '(\s)*' ..same no?
Code: Select all
$content = <<<QQQ
<td width="126"><font color="D7D7D7" size="1" face="Verdana, Arial, Helvetica, sans-serif">
Hello world
</font></td>
QQQ;
$string1 = '.*<td .*<font .*sans-serif">\s*(\S.*\S)\s*<\/font><\/td>';
preg_match_all("/$string1/Ui", $content, $matches1);
$string2 = '.*<td .*<font .*sans-serif">(\s)*(\S.*\S)\s*<\/font><\/td>'; // same as $string1, but parentheses added to the first \s
preg_match_all("/$string2/Ui", $content, $matches2);
print_r($matches1);
print_r($matches2);Code: Select all
Array(
[0] => Array()
[1] => Array()
)
Array(
[0] => Array(
[0] => <td width="126"><font color="D7D7D7" size="1" face="Verdana, Arial, Helvetica, sans-serif">
Hello world
</font></td>
)
[1] => Array(
[0] =>
)
[2] => Array(
[0] => Hello world
)
)