On 28/08/07, Brian Rue [EMAIL PROTECTED] wrote:
Sure, I'll break it apart a little:
Er, wow, thanks. Lots of material here...
'{(?=p(?:|\s)(?!.*p(?:|\s)))}is'
$regex = '{' . // opening delimeter
'(?=' . // positive lookahead: match the beginning of a position
On 27/08/07, Richard Lynch [EMAIL PROTECTED] wrote:
On Sun, August 26, 2007 3:41 pm, Dotan Cohen wrote:
I have a string with some HTML paragraphs, like so:
$text=pFirst paragraph/p\npMore text/p\npSome more
text/p\npEnd of story/p;
I'd like to add an image before the last paragraph. I
Dotan, try this:
$text=pFirst paragraph/p\npMore text/p\npSome more
text/p\npEnd of story/p;
$story = preg_replace('{(?=p(?:|\s)(?!.*p(?:|\s)))}is', pnew
paragraph goes here/p\n, $text);
This matches a position that has an opening p tag (with or without
parameters), which is NOT followed
On 27/08/07, Brian Rue [EMAIL PROTECTED] wrote:
Dotan, try this:
$text=pFirst paragraph/p\npMore text/p\npSome more
text/p\npEnd of story/p;
$story = preg_replace('{(?=p(?:|\s)(?!.*p(?:|\s)))}is', pnew
paragraph goes here/p\n, $text);
This matches a position that has an opening p tag
-general@lists.php.net
Subject: Re: [PHP] Adding text before last paragraph
On 27/08/07, Brian Rue [EMAIL PROTECTED] wrote:
Dotan, try this:
$text=pFirst paragraph/p\npMore text/p\npSome more
text/p\npEnd of story/p;
$story = preg_replace('{(?=p(?:|\s)(?!.*p(?:|\s)))}is', pnew
paragraph goes
On Mon, August 27, 2007 1:46 am, Dotan Cohen wrote:
On 27/08/07, Richard Lynch [EMAIL PROTECTED] wrote:
On Sun, August 26, 2007 3:41 pm, Dotan Cohen wrote:
I have a string with some HTML paragraphs, like so:
$text=pFirst paragraph/p\npMore text/p\npSome more
text/p\npEnd of story/p;
On Mon, August 27, 2007 5:45 pm, Dotan Cohen wrote:
Thank you Brian. This most certainly works. I'm having a very hard
time decyphering your regex, as I'd like to learn from it. I'm going
over PCRE again, but I think that I may hit google soon. Thank you
very, very much for the working code.
I have a string with some HTML paragraphs, like so:
$text=pFirst paragraph/p\npMore text/p\npSome more
text/p\npEnd of story/p;
I'd like to add an image before the last paragraph. I know that
preg_replace can replace only the first n occurrences of a string, but
how can I replace the _last_
On Sun, August 26, 2007 3:41 pm, Dotan Cohen wrote:
I have a string with some HTML paragraphs, like so:
$text=pFirst paragraph/p\npMore text/p\npSome more
text/p\npEnd of story/p;
I'd like to add an image before the last paragraph. I know that
preg_replace can replace only the first n
9 matches
Mail list logo