title: how do i convert a c# style regular expression to c++ style
body: <p>I was trying to parse a lengthy string through a regular expression, i tried doing it with the following RE and text mentioned at this link <a href="http://regexr.com/3a7uf" rel="nofollow">http://regexr.com/3a7uf</a></p>
  
  <p>But when I try to parse the text in c++ using the same RE, the compile time warnings and output not as expected.</p>
  
  <p>Please advise how to get this RE sorted into a format so that it becomes possible to parse text, in a C++ program.</p>
  
  <p>The code goes like this: </p>
  
  <pre><code>std::string str = "root     21015  0.0  0.0      0     0 ?        S    "
      "16:07   0:00 [kworker/5:0]\n            root     21095  0.0  0.0  "
      "    0     0 ?        S    16:08   0:00 [kworker/2:2]\n            "
      "root     21097  0.0  0.0      0     0 ?        S    16:08   0:00 ["
      "kworker/u16:4]\n            ashish   21103 17.1  1.2 591536 106056"
      " ?       Sl   16:12   0:01 /usr/lib/firefox/firefox";
  
  std::regex firefox ("[0-9].\..*.firefox");
  
  std::smatch sm;
  std::regex_match (str, sm, firefox);
  std::cout &lt;&lt; "number of matches: " &lt;&lt; sm.size() &lt;&lt; std::endl;
  
  std::cout &lt;&lt; "matches were: " &lt;&lt; std::endl;
  for (unsigned int i = 0; i &lt; sm.size(); i++)
  {
      std::cout &lt;&lt; "[" &lt;&lt; sm[i] &lt;&lt; "]";
  }
  </code></pre>
  
  <hr>
  
  <p><strong><em>warning during compilation as follows:</em></strong></p>
  
  <pre><code>warning: unknown escape sequence: '\\.'
       regex firefox ("[0-9].\\..*.firefox");
  </code></pre>
  
  <hr>
  
  <p><strong><em>output is as follows:</em></strong></p>
  
  <pre><code>number of matches: 0
  
  matches were:
  </code></pre>