I am using some regular expressions in my application. I am making changes to the application mentioned below-:


http://qt-project.org/doc/qt-4.8/ric...ghlighter.html

Making changes to the highlighter.cpp file of the application, I have done something like this :-

Qt Code:
  1. QTextCharFormat plus,quotationformat;
  2.  
  3. quotationFormat.setForeground(Qt::blue);
  4. rule.pattern = QRegExp("\".*\"");
  5. rule.format = quotationFormat; // for double quotes
  6. highlightingRules.append(rule);
  7.  
  8.  
  9. plus.setForeground(Qt::red);
  10. rule.pattern = QRegExp("\\+");
  11. rule.format = plus;
  12. highlightingRules.append(rule);
To copy to clipboard, switch view to plain text mode 


The problem I am facing is that if '+' is written inside double quotes , the quotation format rules does not apply on it. Something like this-:
If I write + outside quotes, it is displayed in red like-:

Adding 1 + 2 makes 3.

But If I write it inside quotes like-:

"Adding 1 + 2 makes 3...."
..

I want that + should also appear in blue when i type it inside quotes. Can anyone help me what mistake I am making??