Kotlin Remove all non alphanumeric characters : <p>I am trying to remove all non alphanumeric characters from a string.</p>

<p>I tried using <code>replace()</code> with a regex as followed:</p>

<pre><code>var answer = answerEditText.text.toString()
Log.d("debug", answer)
answer = answer.replace("[^A-Za-z0-9 ]", "").toLowerCase()
Log.d("debug", answer)
</code></pre>

<blockquote>
  <p>D/debug: Test. ,replace</p>
  
  <p>D/debug: test. ,replace</p>
</blockquote>

<p>Why are the punctuation characters still present? How to get only the alphanumeric characters?</p>
