title: Qt QRegExp with whitespace did not work
body: <p>I'm new to Qt. I want to check the input value of the QLineEdit: if the input starts with whitespace, turn the font color to black, else make it red. But It doesn't work well. </p>
  
  <p><strong>Here is the code:</strong></p>
  
  <pre><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  
  MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
  
  
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  
  void MainWindow::on_lineEdit_textChanged(const QString &amp;arg1)
  {
      QRegExp  regexp("^\s*");
  
      if(!regexp.exactMatch(arg1))
      {
          ui-&gt;lineEdit-&gt;setStyleSheet("color:red");
      } else
  
      {
          ui-&gt;lineEdit-&gt;setStyleSheet("color:black");
      }
  
  }
  </code></pre>
  
  <p>So when I run this code and start with space,It turns red , I can't figure out why this happen.</p>
  
  <p><strong>UPDATED QUESTION</strong></p>
  
  <p>Here is what I think:
    If I want to mark red when the input does not digit ,the RegExp should like this:   </p>
  
  <pre><code>void MainWindow::on_lineEdit_textChanged(const QString &amp;arg1)
  {
      QRegExp  regexp("^[0-9]*");
  
      if(regexp.exactMatch(arg1)) {
          ui-&gt;lineEdit-&gt;setStyleSheet("color:black");//if the input is digits,black
      } else {
          ui-&gt;lineEdit-&gt;setStyleSheet("color:red");//not digits,red
      }
  }
  </code></pre>
  
  <p>And It work as I wanted . But when I add <code>\s</code> in RegExp(<code>QRegExp regexp("^\s[0-9]*")</code>),digits start with whitespaces or pure digits are turning red. Why is  that?</p>