title: Qt Syntax Highlighter Example highlighting rule for single line comments
body: <p>Taken from Qt Syntax Highlighter Example:</p>
  
  <pre><code>//single line comment rule
  singleLineCommentFormat.setForeground(Qt::darkGray);
  rule.pattern = QRegExp("//[^\n]*");
  rule.format = singleLineCommentFormat;
  highlightingRules.append(rule);
  //string rule
  quotationFormat.setForeground(Qt::darkGreen);
  rule.pattern = QRegExp("\".*\"");
  rule.pattern.setMinimal(true);
  rule.format = quotationFormat;
  highlightingRules.append(rule);
  </code></pre>
  
  <p>The Problem is when you have something like this:</p>
  
  <pre><code>"inside is darkGreen//"outside is darkGray
  </code></pre>
  
  <p>As you can see, the result is: inside the quotations will be gray including the double / . But the characters outside "" becomes darkGray which is supposed to be in default font color(normally, black). How do i adjust the RegExp for single line comment inorder for it to know that a green "//" is exempted from the darkGray highlighting rule?</p>
  
  <p>I tried to add this for the singe line comment rule:</p>
  
  <pre><code>rule.pattern.setMinimal(true);
  </code></pre>
  
  <p>Still won't work. I Also tried:</p>
  
  <pre><code>rule.pattern = QRegExp("//[^\n]*\"*");
  </code></pre>