regex Illegal repetition
<p>I have a string array of operators that I am iterating through.  When I find one that exists in <code>strLine</code>, I replace the first instance of it with a blank string.  When I get to the <code>{</code>, I get the <code>java.util.regex.PatternSyntaxException: Illegal repetition</code>.</p>

<p>Now, I know that the <code>{</code> is a special java operator so that is the reason it is failing.  What would be the best way to escape this character with the setup I have now?</p>

<pre><code>String[] operators = {".", ",", "{", "}", "!", "++", "--", "*", "/", "%", "+", "-", "&lt;"}

String strLine = "for (int count = input.length(); count &gt; 0; count--) {";
strLine = strLine.trim();

for (int i = 0; i &lt; operators.length; i++) {
    if(strLine.contains(operators[i])) {

        strLine = strLine.replaceFirst(operators[i]+"\\s*", "");
        System.out.println("Removal of: " + operators[i]);
        System.out.println("Sentence after removal: " + strLine);
    }
}
</code></pre>
