title: How to check if a particular characters are available in a javascript string array
body: <p>I have a javascript array like</p>
  
  <pre><code>var main_array = ["allen~1", "ajay~2", "raj~3"];
  </code></pre>
  
  <p>I have another array like</p>
  
  <pre><code>var sub_array=["allen", "ajay"];
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>I need to check whether each values of sub_array is found in main_array, (i.e) whether <strong>'allen' found in ["allen~1", "ajay~2", "raj~3"]</strong> so the values which do not match must be removed from the array. As the result "raj~3" must be removed from the main_array </p>
  
  <p>How to achieve this?</p>
  
  <p>I have <strong>tried indexOf(), match()</strong> but that fails since it expects an exact match like "allen~1"..</p>
  
  <p>Thanks in advance</p>