He needs both. /s makes dot to include new lines too, so you're right.

Niklas


-----Original Message-----
From: Tom Rogers [mailto:[EMAIL PROTECTED] 
Sent: 3. huhtikuuta 2003 16:26
To: Thomas Johnsson
Cc: [EMAIL PROTECTED]
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/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to