how can I get seperate the HTML in the_content(); output?

Look at this snippet from CSS-Tricks. It gets the first image from a post.