title: Detect if string matches format specifier string
body: <p>I'm trying to do the process of formatting a string in reverse, that is to match an existing string to a printf like string format specifier string. </p>
  
  <p>I have an array of several strings, like so:</p>
  
  <pre><code>var strings = [
       "I have the number 5 and the word dog",
       "15 of your cows are belong to us"
  ];
  </code></pre>
  
  <p>I also have an array of format strings that correspond to these strings:</p>
  
  <pre><code>var formats = [
      "I have the number %i and the word %s",
      "%i of your %s are belong to us"
  ];
  </code></pre>
  
  <p>In my particular use case, I only need to match integers and single word strings. </p>
  
  <pre><code>function getFormatString(string) {
      //What I'm trying to accomplish
  }
  
  getFormatString(strings[0]); //returns formats[0];
  getFormatString(strings[1]); //returns formats[1];
  </code></pre>
  
  <p>Building a regular expression for each format string seems to be the best idea I can think of, but I'm not sure how to go about doing this. I also want to extract the values of the string using the format string. </p>