On 28/08/07, Brian Rue <[EMAIL PROTECTED]> wrote:
> Sure, I'll break it apart a little:
Er, wow, thanks. Lots of material here...
> '{(?=|\s)(?!.*|\s)))}is'
>
> $regex = '{' . // opening delimeter
> '(?=' . // positive lookahead: match the beginning of a position
>
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
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="First paragraph\nMore text\nSome more
>> > text\nEnd of story";
>
h, the replacement string gets inserted
at the matched position.
I hope that made at least a little bit of sense :) If you're doing a lot of
regex work, I would strongly recommend reading the book Mastering Regular
Expressions by Jeffrey Friedl... it's very well written and very helpful.
-
On 27/08/07, Brian Rue <[EMAIL PROTECTED]> wrote:
> Dotan, try this:
>
> $text="First paragraph\nMore text\nSome more
> text\nEnd of story";
>
> $story = preg_replace('{(?=|\s)(?!.*|\s)))}is', "new
> paragraph goes here\n", $text);
>
> This matches a position that has an opening tag (with or witho
Dotan, try this:
$text="First paragraph\nMore text\nSome more
text\nEnd of story";
$story = preg_replace('{(?=|\s)(?!.*|\s)))}is', "new
paragraph goes here\n", $text);
This matches a position that has an opening tag (with or without
parameters), which is NOT followed anywhere in $text by anothe
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="First paragraph\nMore text\nSome more
> > text\nEnd of story";
> >
> > I'd like to add an image before the last paragraph. I
On Sun, August 26, 2007 3:41 pm, Dotan Cohen wrote:
> I have a string with some HTML paragraphs, like so:
> $text="First paragraph\nMore text\nSome more
> text\nEnd of story";
>
> I'd like to add an image before the last paragraph. I know that
> preg_replace can replace only the first n occurrences
8 matches
Mail list logo