preg_match_all()
| From: | Thomas Johnsson | Date: | Thu, 03 Apr 2003 13:33:02 +0000 |
| Subject: | preg_match_all() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-142126@lists.php.net to get a copy of this message | ||
I am having problems with preg_match_all spanning over newlines.
Using /m does not seem to ignore the the newlines.
// This works
// Both contents inside <td> and </td> are found
$html = '<tr valign="top">
<td width="10">One cell</td>
<td>Another</td>
</tr>';
// This does not
// Only the contents inside the first <td> and </td> are found
// The only difference is that there is a linebreak efter the second <td>
$html = '<tr valign="top">
<td width="10">One cell</td>
<td>
Another</td>
</tr>';
preg_match_all("/<td.*>(.*)<\/td>/m", $html, $out);
I have been doing this before, but I can't remember how I got it working...
Any thougts?