title: How to play sound in local directory based on keyword given
body: <p>I have two conditions here that need to be solved. </p>
  
  <ol>
  <li><p>I have sound files in my directory and would like to play it based on keyword given. So both keywords and sound file name that match each other will make the sound played.</p></li>
  <li><p>However, I need to pick one of those keywords given to be matched with any of the sound file name in my directory. </p></li>
  </ol>
  
  <p>For example, i have keywords as follows:</p>
  
  <p><strong><em>cat, mammal, small to medium sized cats, cat like mammal, whiskers, kitten, fur, domestic long haired cat, domestic short haired cat, norwegian forest cat</em></strong></p>
  
  <p>"cat" is matched with one of my sound file named "cat". Then the system will play the cat sound file (e.g. meow sound).</p>
  
  <p>fyi, those keywords are changed frequently in my system. And the keywords are shown on HTML as a string.</p>
  
  <p>Do you have any idea how to solve this? I'm using HTML and javascript.
  Big thanks!!</p>
  
  <pre><code>var b = document.getElementById("myAudio");
  
  var c = document.getElementById('demo').innerHTML;
  
     switch (c) {
          case "cat" :
            var res = c.match(/cat/g);
              b.play();
              break;
          default:
             b.play();
             break;
          }
  </code></pre>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;audio id="myAudio"&gt;
  &lt;source src="sound/cat.wav" type="audio/wav"&gt;                
  &lt;/audio&gt;
  
  
  
            </code></pre>
  </div>
  </div>
  </p>