Разделяй и властвуй?
предположим, что $ myString - ваша строка ...
Сначала возьмите цитируемый материал:
preg_match (" /(.*?)<b>(.*?)<\/b>(.*?)/", $myString);
теперь у вас есть 1, 2 и 3 $ 100 *
$firstMatches = preg_split("/[\.\!\?]/", $1);
$lastMatches = preg_split("/[\.\!\?]/", $3);
Тогда верните пунктуацию:
function addPunctuation($matches, $myString)
{
$punctuadedResults = array();
foreach($matches as $match)
{
$position = strpos( $myString, $match);
#position is the offset of the start of your match. Find the character after your match.
$punctMark = substr($myString, $position + length($match), 1);
$punctuadedResults[] = $match . $punctMark;
}
return $punctuadedResults;
}
$allMatches = addPunctuation($firstMatches, $myString);
$allMatches[] = $2;
$allMatches = array_merge($allMatches, addPunctuation($lastMatches, $myString) );