You could use DOMDocument, which will parse your HTML. This means that you can use str_replace only on the contents of your elements, rather than risk modifying their attributes as well.
It looks a lot more long-winded but it's also a lot safer and will still continue to work if the format of your HTML changes slightly in the future:
$html = '<span class="post-excerpt"> - <a href="./posts/the-post-title">17 posts</a> - Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie, musica, sport etc, litot Europa usa li sam vocabular. Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules. Omnicos directe al desirabilite de un nov lingua franca: On refusa continuar payar custosi traductores. At solmen va esser necessi far uniform grammatica, pronunc</span>';
$doc = new DOMDocument();
$doc->loadHTML($html);
// DOMDocument creates a valid HTML document, adding a doctype, <html> and <body> tags
// The following two lines remove them
// http://stackoverflow.com/a/6953808/2088135
$doc->removeChild($doc->firstChild);
$doc->replaceChild($doc->firstChild->firstChild->firstChild, $doc->firstChild);
$span = $doc->getElementsByTagName('span')->item(0);
foreach ($span->childNodes as $node) {
$node->nodeValue = str_replace(' - ', '', $node->nodeValue);
}
echo $doc->saveHTML();
Output:
<span class="post-excerpt"><a href="./posts/the-post-title">17 posts</a>Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie, musica, sport etc, litot Europa usa li sam vocabular. Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules. Omnicos directe al desirabilite de un nov lingua franca: On refusa continuar payar custosi traductores. At solmen va esser necessi far uniform grammatica, pronunc</span>