title: Find $number and then replace it with $number+1?
body: <p>I would like to find <code>$number</code> substrings and then replace them with <code>$number + 1</code> format.</p>
  
  <p>For example, <code>$1</code> should become <code>$2</code> in a string.</p>
  
  <p>So far, I found out how to find <code>$number</code> pattern in a string and then replace them with other string using regex and it works fine.</p>
  
  <p><strong>My Code :</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;regex&gt;
  
  std::string replaceDollarNumber(std::string str, std::string replace)
  {
      std::regex long_word_regex("(\\$[0-9]+)");
      std::string new_s = std::regex_replace(str, long_word_regex, replace);
      return new_s;
  }
  
  int main()
  {
      std::string str = "!$@#$34$1%^&amp;$5*$1$!%$91$12@$3";
      auto new_s = replaceDollarNumber(str, "&lt;&gt;");
      std::cout &lt;&lt; "Result : " &lt;&lt; new_s &lt;&lt; '\n';
  }
  </code></pre>
  
  <p><strong>The Result :</strong></p>
  
  <pre><code>Result : !$@#&lt;&gt;&lt;&gt;%^&amp;&lt;&gt;*&lt;&gt;$!%&lt;&gt;&lt;&gt;@&lt;&gt;
  </code></pre>
  
  <p><strong>The Result I want :</strong></p>
  
  <pre><code>Result : !$@#$35$2%^&amp;$6*$2$!%$92$13@$4
  </code></pre>
  
  <p>Is it possible to do this using regex?</p>