Emacs query-replace-regexp multiline

How do you do a query-replace-regexp in Emacs that will match across multiple lines? as a trivial example I'd want <p>\(.*?\)</p> to match <p>foo bar </p>