title: Can Anyone explain how to identify the match text in jquery?
body: <p><em>Assume that newFile[0] = 'Dany' and prsntFile[0] = 'Dany'. If newFile equal to present file then alert will work.</em> My question is some time prsntFile[0] = 'Dany - 1' and my newFile[0] = 'Dany' but for this also i want to trigger the alert function.</p>
  
  <p>prsntFile[0] may also contain dany -2 or dany -3. for this also i want to alert 'match'. any solution guys*</p>
  
  <pre><code>var newFile = 'Dany';
  $(".copyDoc").each(function(){
      var existFiles = this.value;
      var prsntFile = existFiles.split('.');
      if(newFile[0] == prsntFile[0]){
          alert('match');
      }elseif(newFile[0] == prsntFile[0]){
  
      }
      //alert(newFile[0]);
  });
  </code></pre>
  
  <p>My Input hidden field</p>
  
  <pre><code>&lt;input class="copyDoc" name="copyDoc[]" value="Dany - 1" type="hidden"&gt;
  </code></pre>