My string looks like so
February 2009
bla bla
March 2009
doo daa bla lbla
Septemer 2009
So I wrote this regex to split it up into months (which is what I want to do first, I think)
$regex = '/(.*)\s(\d){4}/i';
This matches them perfectly, except it throws away the actual string they were split on .. i.e. I want that information (as in February 2009, March 2009 etc)
I've tried mucking around with the preg_split()
flags, but could not get what I wanted.
Should I be using a different approach? Is there an easy to split text via a regex but keep the text that was actually there?
Come to think of it, I could probably use `preg_match_all()' here... I hope I just didn't answer my own question in the answer - I'm going to post anyway to see what the community thinks.
Thanks