dprichard
11-07-2010, 06:37 PM
I need to figure out how to extract a date out of a string. Sometimes it is at the beginning, sometimes it is in the middle with a space on each side. I have my preg_match pulling out the year, but only at the beginning of the string.
preg_match('/^\d{4} /',$title,$matches);
If they put anything before the year it doesn't see the year. I can't quite figure out how to pull the year if it isn't at the beginning of the string. Any help would be great.
Thank you.
preg_match('/^\d{4} /',$title,$matches);
If they put anything before the year it doesn't see the year. I can't quite figure out how to pull the year if it isn't at the beginning of the string. Any help would be great.
Thank you.