Java escaped sequence syntax error
<p>I'm trying to create a string array with lines of codes, so that the program can over-write a portion of existing code once it hits a mark. My problem comes on this line:</p>

<pre><code>var finalTitle = (str.replace("()", ("(" + num + ")")));
</code></pre>

<p>As I am attempting to convert that line into a valid string, I understand that the quotation mark can be somewhat tricky to parse. This is what I have so far:</p>

<pre><code>"var finalTitle = (str.replace(\"()\", (\"(\" + num + \")\")));"
</code></pre>

<p>However, eclipse will not stop complaining that the syntax of this line is incorrect. Does anyone know how to correctly format this line? Or possibly more specifically, how to parse quotation marks into a string?</p>

<p>Here is an example of the string array I am filling. I am going to loop through it with each iteration writing a new line to the .js file:</p>

<pre><code>String[] lines = {"var patientTree = getPatientMenuTree();", "var rootNode = patientTree.getNodeById('Patients');", "var str = rootNode.title;", "var num = patientArray.length;", "var finalTitle = (str.replace(\"()\", (\"(\" + num + \")\")));" };
</code></pre>
