In $mystring, I need to extract everything between "|News Releases|" and

The thing now is $mystring might contain many instances of "|News
and "-30".

How do I deal with this? My code only catches the first instance.

Thanks for you help so far.


I do find it intuitive actually, when reading things back your answer is after the question, which makes sense. The other way around doesn't?
I'll never get it. Newest work on top of the pile, instead of digging :))
On Sun, Sep 2, 2012 at 4:33 PM, Frank Arensmeier <> wrote:
My approach would be to split the hole text into smaller chunks (with e.g. 
explode()) and extract the interesting parts with a regular expression. Maybe 
this will give you some ideas:
$chunks = explode("-30-", $mystring);
foreach($chunks as $chunk) {
         preg_match_all("/News Releases\n(.+)/s", $chunk, $matches);
The regex matches all text between "News Releases" and the end of the chunk.
It shouldn't be needed to explode the string first, you could do that
with a single preg_match_all. (Sorry, can't remember how anymore, it's
been a while since I last used PCRE ).
I'll get the PCRE eventually. Never had much time for PERL after PHP stated anyhow :)p

I think the split by -30- works nicely.

2) How could I suck it into one nice easy to handle array?

|$mynewarray=|array {
  [0]=> "Residential Fire Determined to be Accidental in Nature ..."
  [1]=> "Arrest Made in Residential Fire ..."


PHP General Mailing List (
To unsubscribe, visit:

Reply via email to