He provides the complete code in the answer along with a thorough explanation. The code also covers:

excerpt length

“Read more” links

smart breaks based on regular expressions (so that the_excerpt() doesn’t cut off in mid-sentence)

For the record, below is my own customization of Pieter’s code, which I am now using for the front page of this site. My changes are mostly small things: adding allowed tags, removing the comma and semicolon from the list of smart break punctuation, shortening the word count, etc.