Ok, it’s 2 hours that i try. It’s time to ask someones here at stackoverflow.
I have this source html:
<div class="post_main">
Post Content (has HTML)
</div><div class="post_email">[...]
Other Stuff
<div class="post_main">
Post Content (has HTML)
</div><div class="post_email">[...]
Other Stuff
<div class="post_main">
Post Content (has HTML)
</div><div class="post_email">[...]
And so on.
I want to add “Something” before every Post Content.
To do so i’m using preg_replace, but it won’t work. Since that i’m actually using
'|<div class="post_main">(.*)</div><div class="post_email">|s
As regex, the
"</div><div class="post_email">"
is eaten from the (.*) and i have only one substitution instead of 3.
Now, how can i get this preg match:
Match everthing included newline, but exclude a given string (in this case:
"</div><div class="post_email">")
?
Thank you a lot.
1 Answer