title: Android Kotlin regex to replace a substring, get the substring that was replaced
body: <p>If I have a string, say, </p>
  
  <pre><code>"Hello, world!" 
  </code></pre>
  
  <p>and a regex equation that is</p>
  
  <pre><code>"world".toRegex()
  </code></pre>
  
  <p>and I call</p>
  
  <pre><code>"Hello, world!".replace("world".toRegex(), "universe")
  </code></pre>
  
  <p>I get the resulting string</p>
  
  <pre><code>"Hello, universe!"
  </code></pre>
  
  <p>This is all working as expected... but what if I wanted to keep a copy of that string I took out? I want to keep a copy of "world" in a variable.</p>