title: What regular expressions can I use in c++,using regex, to parse separators,operators,identifiers, and real numbers?
body: <pre><code>  for(int k = 0 ; k &lt; 5.25;k++)
       {
        cout&lt;&lt;"hello"&lt;&lt;endl;
        }
      return 0;
  </code></pre>
  
  <p>I'm writing a c++ program for lexical analysis on a simple text file containing
        c++ code. For example</p>
  
  <p>Then, after the program has extracted the code from the file, it will output to
        the console:</p>
  
  <pre><code>   for: keyword
       (: separator
       int: keyword
       k: identifier
       =: operator
       0: integer
       ;: separator
       k: identifier
       &lt;: operator
       5.25: real
       and so forth.
      I already have "(\\w+)" for words, "(\\d+)" for integers, however I don't
      know how to write any of the rest.
  </code></pre>
  
  <p>To give you an idea of what my actual code looks like for a regular expression, here it is.</p>
  
  <pre><code>     void lexical_integer(string seq)
       {
  
  regex digits("(\\d+)");
  regex_iterator&lt;string::iterator&gt; itd(seq.begin(), seq.end(), digits);
  regex_iterator&lt;string::iterator&gt; end;
  
  for (; itd != end; ++itd)
  {
      cout &lt;&lt; itd-&gt;str() &lt;&lt;" " &lt;&lt;" integer"&lt;&lt; endl;
  }
       }
  </code></pre>
  
  <p>I'm looking for regular expressions that I can use with regex in c++
          so
          words: "(\w+)" 
          integers:"(\d+)"
          separators: ?
          operators: ? 
          real numbers: ?</p>