title: Why closing square bracket "]" doesn't require escaping in regex?
body: <p>Consider the array:</p>
  
  <pre><code>new Pattern[] {Pattern.compile("\\["),Pattern.compile("\\]") };
  </code></pre>
  
  <p>Intellij IDEA tells me that <code>\\</code> is redundant and tells me to replace this with <code>]</code> e.g. the result is:</p>
  
  <pre><code>new Pattern[] {Pattern.compile("\\["),Pattern.compile("]") };
  </code></pre>
  
  <p>Why in the first <code>Pattern.compile("\\[")</code> is the <code>\\</code> OK, but for the second it is redundant?</p>