title: Pattern for DNF Function (javascript regular expression)
body: <p>I would like to validate the DNF (Disjunctive normal form) which looks like this <code>A*B+A'*C+C*D*E'</code>. For this purpose, I use the folloing following pattern:</p>
  
  <pre><code>/[A-Z]'?(\*[A-Z]'?)*(\+[A-Z]'?(\*[A-Z]'?)*)+/g
  </code></pre>
  
  <p>I have tested this pattern using javascript test() method in this online tool:
  <a href="http://www.pagecolumn.com/tool/regtest.htm" rel="nofollow">http://www.pagecolumn.com/tool/regtest.htm</a> and it gives me the result I have expected.</p>
  
  <p>I tried to test the pattern with javascript, using the following code:</p>
  
  <pre><code>  &lt;script type="text/javascript"&gt;
      var dnf="A*3+A*B+CD";
      var pattern= /[A-Z]'?(\*[A-Z]'?)*(\+[A-Z]'?(\*[A-Z]'?)*)+/g;
      var flag = false;
      flag=pattern.test(dnf);
      console.log(flag);
    &lt;/script&gt;
  </code></pre>
  
  <p>The problem is, I don't understand, why flag (in this code) become "true", which has to be "false" cause the terms A*3 and CD in the <code>dnf="A*3+A*B+CD"</code>.</p>
  
  <p>I have testet this in the online tester and it says: no matches, what I think is right. </p>