Re: patch for Text/Wiki/rules/url.php

From: Date: Wed, 07 Jan 2004 11:02:55 +0000
Subject: Re: patch for Text/Wiki/rules/url.php
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-24845@lists.php.net to get a copy of this message
Hi Jim Winstead, you wrote: > to be this: > > <p>This is the first paragraph.</p> > <p>This is the second paragraph.</p> > <p>This is the third paragraph.</p> > > but get: > > This is the first<p>paragraph.</p> > This is the second<p>paragraph.</p> > This is the thirdparagraph. Hi guys, I dunno if the following would be the appropriate behaviour, (I've no insight in Text_Wiki yet) but it would wrap all in paragraphs: --- $re = array('/(.*?)((?!\\\\)(\r\n|\r|\n)){2,}(.*?)/s', '/\\\\(\r\n|\r|\n)/'); $rp = array('\\1\\2</p><p>\\4', ''); $tx = "\n\n\n\nThis is the first \ \ paragraph.\n\n\n\n\n\nThis is the \ second\nparagraph.\n\nThis is the \ third\nparagraph."; $rs = '<p>' . preg_replace($re, $rp, trim($tx)) . '</p>'; echo $rs; --- Output doesn't look nice, but it works as expected (for me ;) Regards, -- Michael - < mike(@)php.net >

Attachment: [application/pgp-signature]
« previous php.pear.dev (#24845) next »