title: condition in regular expression qt
body: <p>I wrote a regular expression for find the scopes('{'|'}'). I want to find the scopes that wasn't  commented, but I don't understand where I have mistake. Here are a fragment of code:</p>
  
  <pre><code>    while (start &gt;= 0 &amp;&amp; end &gt;=0) {
          start = text.indexOf("\n", start);
          end  = text.indexOf(QRegExp("^.*[{](?!=[//]|[/*]|[*]))"),start);
          end2  = text.indexOf(QRegExp("^.*[}](?!=[//]|[/*]|[*]))"), start);
          if (end &lt; end2) {
              text.replace(end,"\n{\n");
          }
          else  text.replace(end2,"\n}\n");
          ++start;
     }
  </code></pre>
  
  <p>For example, we have some text:</p>
  
  <pre><code>//dfsdkfj ksjdfksjdf {  &lt;- this symbol should be skipped
  public SystemBlock()
  {  //&lt;- this symbol should be found. 
      this.producer = "none";
      this.motherBoard = "none";
      this.processor = "none";
      this.ram = "none";
      this.gpu = "none";
      this.price = 0;
      this.eventSupport = null;
  }
  </code></pre>