I don't know if this is robust enough for you. the gist is identify some text with a regular expression, and replace that text with something else. I use re-builder to help create the regexps.


#+BEGIN_SRC emacs-lisp
(let ((s " <div class=\"csl-entry\">Broder, John M., and Ian Urbina. “All Eyes Turn to Virginia Senate Race.” <i>The New York Times</i>, November 9, 2006, sec. /. <a href=\"http:hostname/url.\">http://hostname/url.</a></div>"))             

  (setq s  (replace-regexp-in-string "\\(\.\\)\"" "" s nil nil 1))
  (setq s  (replace-regexp-in-string "\\(\.\\)</a>" "" s nil nil 1)))
#+END_SRC
#+RESULTS:
:  <div class"csl-entr">Broder, John M., and Ian Urbina. “All Eyes Turn to Virginia Senate Race.” <i>The New York Times</i>, November 9, 2006, sec. /. <a href"http:hostname/url">http://hostname/url</a></div>






John

-----------------------------------
Professor John Kitchin 
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803

On Thu, Jan 29, 2015 at 9:36 PM, Matt Price <moptop99@gmail.com> wrote:
I'm sorry to come with a basic elisp question, once again. 

I continue to work on this citation stuff.  Currently, I can get html back from Zotero in a form like this:

-----------------
  <div class="csl-entry">Broder, John M., and Ian Urbina. “All Eyes Turn to Virginia Senate Race.” <i>The New York Times</i>, November 9, 2006, sec. /. <a href="http://hostname/url.">http://hostname/url.</a></div>
-----------------

Note the final "." in the href -- this is a bug in the citeproc-js citation engine (I think).

So, I would like to do some postprocessing and just remove the final ".".  But it's not obvious to me how to do that.  I feel like it should be!  And that for an editor, emacs makes it awfully hard to match patterns & edit strings.  But I think that's partly because I simply understand lisp so poorly. 

If someone could show me how to do this, nad somehow along hte way make me understand hte basic principles involved so I can start to teach myself better...  well, I would appreciate it.

thanks again,
Matt