I need a regular expression that will extract sentences from text that contain a year in them.
Example text:
Next, in 1988 the Bradys were back
again for a holiday celebration, "A
Very Brady Christmas". Susan Olsen
(Cindy) would be missing from this
reunion, Jennifer Runyon took her
place. This was a two hour movie in
which the Bradys got together to
celebrate Christmas, introducing the
world to the spouses and children of
the Brady kids. This movie was the
highest rated TV-movie of 1988.
If the example text was variable $string, I need it to return:
$sentenceWithYear[0] = Next, in 1988
the Bradys were back again for a
holiday celebration, "A Very Brady
Christmas".
$sentenceWithYear[1] = This movie
was the highest rated TV-movie of
1988.
If it's possible to retain the year via regex, I'd use the year within the sentence and eventually insert the sentences into a database like:
INSERT INTO table_name (year, sentence) VALUES ('$year', '$sentenceWithYear[x]')