Using 'replace' with a regex is throwing an error. Any ideas why?
I'm not sure what's going on with the story.html part, but you'll need to double escape your regex.

Assuming you have an entry already with a story Rich Text field, it'd look like this:

{{ entry.body|raw|replace("/&lt;p&gt;\\s*(&lt;a .*&gt;)?\\s*(&lt;img .* \\/&gt;)\\s*(&lt;\\/a&gt;)?\\s*&lt;\\/p&gt;/iU", "\1\2\3") }}