title: Remove Characters From String which are not allowing string to pass a regex test
body: <p>I am try to validate a string entered in a comment box against a REGEX pattern. My method looks like : </p>
  
  <pre><code>function skipMetadataSpecChar(val)
  {
      if (val.match(/^[`_,:\057\134\075"';%@#!~\-\&amp;\+\^\[\]\{\}\$\(\)\&lt;\&gt;\|\*\?\_\.,\s,0-9a-zA-Z]+$/)){
          return true;
      }else{
          return false;
      }
  }
  </code></pre>
  
  <p>In one particular Scenario, when a user is pasting a string from somewhere else instead of typing it my method is returning false.
  The Expected outcome should be the string by removing the characters not allowed in the regex.</p>
  
  <p><strong>Sample String :</strong></p>
  
  <p>This is test comment for the length of text as there was a issue in prod due to comment length in the box.This is test comment for the length of text as there was a issue in prod due to comment length in the box.This is test comment for the length of text as there was a issue in prod due to comment length in the box.This is test comment for the length of text as there was a issue in prod due to comment length in the box.This is test comment for the length of text as there was a issue in prod due to comment length in the box.This is test comment for the length of text as there was a issue in prod due to comment length in the box.This is test comment for the length of text as there was a issue in ﻁﻁﻉﻁﻉﻁﻉprod due to comment length in the box.This is test comment for the length of text as there was a issue in prod due to comment length in the box.;%@#This is test comment for the length of text as there was a issue in prod due to comment length in the box. This is test data to vhe issue an$</p>