I'm trying to convert from HTML to Latex, and want to change this:
<a href="www.foo.com/bar">baz</a>
into:
baz\footnote{www.foo.com/bar}
I'd like to generate a Clojure function to take a chunk of text, and replace as many matches as exist in a given paragraph.
I've tried
(.replaceAll
"<a href=\"foo.com\">baz</a>"
"<a.*href=\"(.*)\">(.*)</a>"
"\2\\footnote{\1}")
but that returns:
"^Bfootnote{^A}"
I've also looked at clojure.contrib.str-utils2
, which has a replace function that uses regular expressions, but it doesn't seem to handle backreferences. Am I missing something? Going about this the wrong way? Any help is appreciated.