title: javascript regular expression replace in input form validation
body: <p>When inputting a string with a format: </p>
  
  <blockquote>
    <p>the beginning <code>r</code> or <code>R</code>, then some non-digit letters, I want to
    replace the string with <code>R</code>.</p>
  </blockquote>
  
  <p>It's in this situation: </p>
  
  <pre><code>onkeyup="this.value=this.value.replace(/^[rR]\D/g,'R')"
  </code></pre>
  
  <p>But it does not work. </p>
  
  <p>Somebody can help me out? Thanks.</p>