On Wed, Feb 16, 2011 at 2:55 PM, ken
<gebser@mousecar.com> wrote:
(setq dog (buffer-substring
(re-search-backward "<h1\\|<h2\\|<h3\\|<h4\\|<h5" nil t)
(re-search-forward "</h1>\\|</h2>\\|</h3>\\|</h4>\\|</h5>" nil t)))
What mode are you using to edit html? What version of Emacs? It's likely your major-mode supports balanced tag movements, so this hacky regexp searching isn't necessary.