title: String replacement in ruby on rails
body: <p>I have a text like</p>
  
  <pre><code>details = "1. Command id = 22 Time = 2:30 &lt;br&gt; 2. Command id = 23 Time = 3:30"
  </code></pre>
  
  <p>Now I need to convert it into </p>
  
  <pre><code>"1. http://localhost:3000/command_id=22/home Time = 2:30 &lt;br&gt; 2. http://localhost:3000/command_id=23/home Time = 3:30"
  </code></pre>
  
  <p>I used regex and <code>gsub</code> but it will not do that as <code>gsub</code> will replace same string. Then there are some techniques using <code>sed</code> and <code>awk</code>.</p>
  
  <p>To extract all ids like 22, 23, I used</p>
  
  <pre><code>details.scan(/Command id = [0-9]+/).join(",").scan(/[0-9]+/)
  </code></pre>
  
  <p>Any ideas how to do the above conversion?</p>