title: javascript | String replace using regex
body: <p>I have a class string: <code>width-100 required validate-email validate-unique-email input-success</code>
  And would like to find (special formatted) substring.
  Result should be: <code>validate-email validate-unique-email</code></p>
  
  <p>My code:</p>
  
  <pre><code>var ok = "width-100 required validate-email validate-unique-email input-success".replace(/validate-([A-Z]+)/gi, function(match, $1, $2) {
     return $1;
  });
  
  console.log(ok);
  </code></pre>
  
  <p>But this doesn't work. Where is a mistake?
  Thanks!</p>