note 20740 deleted from function.preg-replace by sniper

From: Date: Tue, 30 Sep 2003 12:30:21 +0000
Subject: note 20740 deleted from function.preg-replace by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-57472@lists.php.net to get a copy of this message
Note Submitter: scf@spamcop.net ---- This function takes plaintext files, seperated by carriage returns and turns it into HTML. In the process it also makes anything in "quotations" bold and anything in (brackets) italic. function fixup( $input ) { $lines=preg_split("/\n/", $input); $patterns = array( "/\"([`´\d\w,\s\.\?'!;:-]+)\"/", "/\(([`´\d\w,\s\.\?'!;:-]+)\)/"); $replace = array( "\"<span class=\"quotes\">\\1</span>\"", "(<span class=\"brackets\">\\1</span>)" ); foreach ($lines as $line_no=>$line) { $new_lines[$line_no] = "<p>".preg_replace($patterns, $replace, stripslashes($line))."</p>"; } $output=implode("\n",$new_lines); return $output; }

« previous php.notes (#57472) next »