title: How to escape the % character in a regular expression?
body: <p>Im currently working a lot with regular expressions and one expression i am search for is a setup like this:</p>
  
  <pre><code>regex r("a\\s([+*/&amp;|^-\%]*|[&lt;&gt;][&lt;&gt;])+=");        // % currently unvailable due to missing escaping
  smatch m1;
  string str = "a++; a--; a += c; a -= c; a *= 3; a /= c; a = c; a %= c + 3; a &amp;= c; a |= c; a ^= c; a &lt;&lt;= c; a &gt;&gt;= c; a &lt;= 3; a &gt;= 3;";
  </code></pre>
  
  <p>This works for the string perfectly, except for the percentage sign. If the percentage sign is included in the first block brackets in the r regex, it throws "std::regex_error what(): Invalid range in bracket expression." </p>
  
  <p>It cant be escaped with the \ frontslash. I read that it can be escaped with another percentage sign and while that stops the error from popping up, it also now doesnt find the "a %=" either and is therefore useless to me.</p>
  
  <p>Hope anyone has an idea how this can be accomplished, i googled a lot and looked here at Stack Overflow but i couldnt find a solution for this yet.</p>