Selecting a row in an HTML table with a regular expression

There is a simple code that selects a substring from a string using a regular expression:

$str = '<tr><div class="dt"></div></tr>';
preg_match('/<tr>(.|\s)*<\/tr>/', $str, $array);
foreach ($array as $value) {
    echo $value;
    echo '<br/>';
}

On the page I get:

<body>
  <div class="dt"></div>
  <br>
    >
  <br>
</body>

Question: Where did this upside down roof come from?


Answer 1, authority 100%

And I got this

<tr><div class="dt"></div></tr><br/>><br/>

Try this

$str = '<tr><div class="dt"></div></tr>';
preg_match('/<tr>(.*)<\/tr>/', $str, $array);
var_dump($array[1]);

Answer 2, authority 50%

Instead of (.|\s)*write (.*), otherwise only the last one comes to the variable $array[1]coincidence. And \sis included in ..