> But what if say I want to replace a newline with something else, say > </p><p>. How would I do that?
(with apologies for the lack of imagination :-P) ------------------------------------------------ <?php $George = "Hello\n\tall\nyou\nfriendly people"; echo 'George: ' . $George . "\n"; $Henry = str_replace( "\n", "</p>\n<p>", $George ); $Henry = '<p>' . $Henry . "</p>\n"; echo 'Henry: ' . $Henry . "\n"; $Helen = "Kindest\r\tgreetings\nto all\r\nyou\n\rwonderful people"; echo 'Helen: ' . $Helen . "\nSee what that \\r does?\n\n"; $Marion = str_replace( "\r", "\n", $Helen ); $Marion = str_replace( "\n\n", "\n", $Marion ); $Marion = str_replace( "\n", "</p>\n<p>", $Marion ); $Marion = '<p>' . $Marion . "</p>\n"; echo 'Marion: ' . $Marion . "\n"; $Juliet = preg_replace( '/([^\r\n]*)(\r\n|\n\r|\r|\n)/', "<p>\${1}</p>\n", $Helen ); $Juliet = preg_replace( '/([^\r\n]+$)/', "<p>\${1}</p>\n", $Juliet ); echo 'Juliet: ' . $Juliet . "\n"; ?> ------------------------------------------------ -- Joel Rees, programmer, Kansai Systems Group Altech Corporation (Alpsgiken), Osaka, Japan http://www.alpsgiken.co.jp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php