title: Perform subtraction within regular expression
body: <p>I have the following RSpec output:</p>
  
  <pre><code>30 examples, 15 failures
  </code></pre>
  
  <p>I would like to subtract the second number from the first. I have this code:</p>
  
  <pre><code>def capture_passing_score(output)
    captures = output.match(/^(?&lt;total&gt;\d+)\s*examples,\s*(?&lt;failed&gt;\d+)\s*failures$/)
    captures[:total].to_i - captures[:failed].to_i
  end
  </code></pre>
  
  <p>I am wondering if there is a way to do the calculation within a regular expression. Ideally, I'd avoid the second step in my code, and subtract the numbers within a regex. Performing mathematical operations may not be possible with Ruby's (or any) regex engine, but I couldn't find an answer either way. Is this possible?</p>