note 27189 deleted from function.ereg-replace by tularis

From: Date: Sun, 29 Aug 2004 12:17:03 +0000
Subject: note 27189 deleted from function.ereg-replace by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75564@lists.php.net to get a copy of this message
Note Submitter: catharsisnOSpAmltd at NoSpam dot hotmail dot com ---- Hi, just thought people might like to know this as I had a bit of a problem getting it to work. Say your recieving this as text (mine is coming in via a form) and you want to convert just simple line returns in HTML. I am assuming you might have Windows based in there. Since I cant put in the HTML tags replace as you see necessary :) $news = "This is a paragraph\n\nNew Line\nNew Line\nNew Line\nNew Line\n\nParagraph 2"; $news = ereg_replace("\r?\n\r?\n", "[closing p tag][opening p tag]", $news); $news = ereg_replace("\r?\n", "[br tag]", $news); $news = "[opening p tag]".$news."[closing p tag]"; I know what you might be thinking.. thats easy! Well for some reason it didnt work with single quoted regular experssions. e.g. $news = ereg_replace('\r?\n\r?\n', '[closing p tag][opening p tag]', $news); Im not sure why the ' doesnt work and " does, but thou7gh all could benefit after I screamed at PHP for a bit *grin* - Chris

« previous php.notes (#75564) next »