problem of replaceAll()
<p>I have written the following line of code:</p>

<pre><code>str.replaceAll("xxx(ayyy)xxx", "$1".substring(0,1).equals("a") ? "a" : "b");
</code></pre>

<p>But I found that "$1".substring(0,1) will output "$" instead of "a". Is that any way to solve this problem?</p>
