Basically, I want to take just one sentence from a collection of anything up to (say) 30 sentences contained in one string, so I need a regexp that will find a full stop / period, and work back (or forward, I guess) until it finds another, and strip that out into another string.
However, if there is only one full stop / period (ie. only one sentence in the block of text, or maybe none (if the user can't punctuate properly), it would have to figure that out too, and return the whole lot...
Basically:
Code: Select all
$sentence = preg_strip("lots/of/clever/stuff", $blockoftext);Anyone?