title: JavaScript RegExp and Join pattern generation
body: <p>We have a simple JS based input text cleanup to extract specific tokens using regExp. which have the format <code>&lt;CHAR&gt;-&lt;NUMBER&gt;</code>. the example code for the same is below. tying to extend this to support the format <code>&lt;CHAR&gt;/&lt;NUMBER&gt;</code> or . please let me know how this can be added to the existing formula or better ideas are welcome.</p>
  
  <p>example: Token of the format MR/56743 or MR56743 should be included as well.</p>
  
  <p>the way the script works is: input anything to the text box and on defoucs it automatically cleansup the non matcing content to just have the matched tokens as comma seperated values.</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
      &lt;script type="text/javascript"&gt;
          var supported = ['ABCDE', 'XZY', 'IR'].sort();
          var pattern = new RegExp(supported.join("-\\d+|") + "-\\d+", "gi");
  
          function filter(raw_input) {
              var raw_text = document.getElementById("raw_text").value;
              document.getElementById("raw_text").value = raw_text.match(pattern);
          }
      &lt;/script&gt;
      &lt;div id="content" style="width:800px;margin:0 auto;text-align:left"&gt;
          Input the scramble for cleanup: &lt;/br&gt;
          &lt;textarea rows="10" cols="80" name="samplebox" id="raw_text" onchange="filter()"&gt;&lt;/textarea&gt;
          &lt;/br&gt;
      &lt;/div&gt;
  &lt;/html&gt;
  &lt;/body&gt;
  </code></pre>