On Sun, Sep 2, 2012 at 10:10 AM, Ashley Sheridan <ash@xxxxxxxxxxxxxxxxxxxx> wrote: > On Sun, 2012-09-02 at 00:23 -0400, John Taylor-Johnston wrote: > >> See: >> http://www.cegepsherbrooke.qc.ca/~languesmodernes/test/test.php >> http://www.cegepsherbrooke.qc.ca/~languesmodernes/test/test.phps >> >> In $mystring, I need to extract everything between "|News Releases|" and >> "-30". >> >> The thing now is $mystring might contain many instances of >> "|News Releases|" and "-30". >> >> How do I deal with this? My code only catches the first instance. >> >> Thanks for you help so far. >> >> John >> >> >> You can use strpos() to find the location of "News Releases" then you >> >> can again use strpos() to find the location of "-- 30 --" but you will >> >> want to feed strpos() an offset for matching "-- 30 --" (specifically >> >> the position found for "News Releases"). This ensures that you only >> >> match on "-- 30 --" when it comes after "News Releases". Once you have >> >> your beginning and start offsets you can use substr() to create a >> >> substring of the interesting excerpt. Once you have the excerpt in hand >> >> you can go back to tamouse's recommendation above. >> > Cheers, >> > Rob. >> >> > > > What code are you using at the moment? It's not very useful to us to > know that your code is half-way there, but then not see the code! > Ash.. Might want to read the mail again, the code is there... ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php