RE: [PHP] preg_match_all()
| From: | Niklas Lampén | Date: | Thu, 03 Apr 2003 13:31:08 +0000 |
| Subject: | RE: [PHP] preg_match_all() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142128@lists.php.net to get a copy of this message | ||
He needs both. /s makes dot to include new lines too, so you're right.
Niklas
-----Original Message-----
From: Tom Rogers [mailto:trogers@kwikin.com]
Sent: 3. huhtikuuta 2003 16:26
To: Thomas Johnsson
Cc: php-general@lists.php.net
Subject: Re: [PHP] preg_match_all()
Hi,
Thursday, April 3, 2003, 11:33:02 PM, you wrote:
TJ> I am having problems with preg_match_all spanning over newlines.
TJ> Using /m does not seem to ignore the the newlines.
TJ> // This works
TJ> // Both contents inside <td> and </td> are found
TJ> $html = '<tr valign="top">
TJ> <td width="10">One cell</td>
TJ> <td>Another</td>
TJ> </tr>';
TJ> // This does not
TJ> // Only the contents inside the first <td> and </td> are found
TJ> // The only difference is that there is a linebreak efter the second
<td>
TJ> $html = '<tr valign="top">
TJ> <td width="10">One cell</td>
TJ> <td>
TJ> Another</td>
TJ> </tr>';
TJ> preg_match_all("/<td.*>(.*)<\/td>/m", $html, $out);
TJ> I have been doing this before, but I can't remember how I got it
working...
TJ> Any thougts?
I think you need /s to cope with newlines
--
regards,
Tom
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
###########################################
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/
###########################################
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/