title: Ruby regular expression utilizing OR within a character class
body: <p>While going through the <a href="http://www.ruby-doc.org/core-2.0/Regexp.html" rel="nofollow">ruby-doc for regular expressions</a>, I came across this example for implementing the &amp;&amp; operator:</p>
  
  <pre><code>/[a-w&amp;&amp;[^c-g]z]/ # ([a-w] AND ([^c-g] OR z))
  # This is equivalent to:
  /[abh-w]/
  </code></pre>
  
  <p>I understand that</p>
  
  <pre><code>/[a-w&amp;&amp;[^c-g]]/ 
  </code></pre>
  
  <p>would equate to </p>
  
  <pre><code>/[abh-w]/
  </code></pre>
  
  <p>because the "^" denotes symbols that should be excluded from the regular expression.</p>
  
  <p>However, I am wondering about why "z" is not also included?  Why was the equivalent regular expression NOT:</p>
  
  <pre><code>/[abh-wz]/
  </code></pre>
  
  <p>I am very new to regular expressions, much less any specifics for regular expressions within Ruby, so any help is greatly appreciated!</p>