title: Java, escaping (using) quotes in a regex
body: <p>I'm trying to use the following regex in Java, that's supposed to match any <code>lang="2-char-lang-name"</code>:</p>
  
  <pre><code>String lang = "lang=\"" + L.detectLang(inputText) +"\"";
  shovel.replaceFirst("lang=\"[..]\"", lang);
  </code></pre>
  
  <p>I know that a single slash would be interpreted by regex as a slash and not an escape character (so my code doesn't work), but if I escape the slash, the <code>"</code> won't be escaped any more and I'd get a syntax error.</p>
  
  <p>In other words, how can I include a <code>"</code> in the regex? <code>"lang=\\"[..]\\""</code> won't work. I've also tried three slashes and that didn't have any matches either.</p>
  
  <p>I am also aware of the general rule that you don't use regex to parse XML/HTML. (and <code>shovel</code> is an XML) However, all I'm doing is, looking for a <code>lang</code> attribute that is within the first 30 characters of the XML, and I want to replace it. Is it really a bad idea to use regex in this case? I don't think using DOM would be any better/more efficient.</p>