fork download
  1. textStr="<testsuite errors=\"0\" tests=\"4\" time=\"4.867\" failures=\"0\" name=\"TestRateUs\">"
  2. new_str = textStr.gsub(/(testsuite errors=\"0\" tests=\")(\d+)(\" time)/) do
  3. Regexp.last_match[1] + (Regexp.last_match[2].to_i + 4).to_s + Regexp.last_match[3]
  4. end
  5. puts new_str
Success #stdin #stdout 0.05s 9600KB
stdin
Standard input is empty
stdout
<testsuite errors="0" tests="8" time="4.867" failures="0" name="TestRateUs">