Re: Another preg question

From: Date: Sat, 14 Feb 2004 22:18:42 +0000
Subject: Re: Another preg question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-177720@lists.php.net to get a copy of this message
> From: Al <news@ridersite.org> > > $text= preg_replace("/\n\n+/", "\n\n", $text); > // remove excess This doesn't seem to do anything. Strange, your code works for me: hj@spirit:~ > cat foo.php <?php $text = "foo\n\n\n\n\nbar"; echo "before:\n===\n$text\n===\n\n"; $text = preg_replace("/\n\n+/", "\n\n", $text); echo "after:\n===\n$text\n===\n\n"; ?> hj@spirit:~ > php ./foo.php before: === foo bar === after: === foo bar === hj@spirit:~ > php -v PHP 4.3.4 (cli) (built: Feb 12 2004 17:42:41) Copyright (c) 1997-2003 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies hj@spirit:~ >

« previous php.general (#177720) next »