title: Move matched text to the end of string using Javascript regular expression
body: <pre><code>hello bye!
  goodbye again.
  </code></pre>
  
  <p>I am hoping to move any occurrences of <code>bye</code> in the text above to the end. I am not sure if it could be done by regex in Javascript.</p>
  
  <p>I expect the output text to be:</p>
  
  <pre><code>hello !
  good again.
  bye
  bye
  </code></pre>