title: How to match a regex with backreference in Go?
body: <p>I need to match a regex that uses backreferences (e.g. \1) in my Go code.</p>
  
  <p>That's not so easy because in Go, the <a href="http://golang.org/pkg/regexp/" rel="noreferrer">official regexp package</a> uses the <a href="http://code.google.com/p/re2/" rel="noreferrer">RE2 engine</a>, one that have <a href="http://swtch.com/~rsc/regexp/regexp3.html" rel="noreferrer">chosen to not support backreferences</a> (and some other lesser-known features) so that there can be a guarantee of linear-time execution, therefore avoiding <a href="http://en.wikipedia.org/wiki/ReDoS" rel="noreferrer">regex denial-of-service attacks</a>. Enabling backreferences support is not an option with RE2.</p>
  
  <p>In my code, there is no risk of malicious exploitation by attackers, and I need backreferences. </p>
  
  <p>What should I do?</p>