Capture values from a string based on pattern : <p>I am looking for an approach to the following problem. It captures all <code>*</code> values from the string using a provided pattern.</p>

<pre><code>function capture(pattern, string) {
}
</code></pre>

<p>Example:</p>

<p>Input</p>

<ul>
<li><p>Pattern <code>The quick brown * jumps over the lazy *</code></p></li>
<li><p>String <code>The quick brown fox jumps over the lazy dog</code></p></li>
</ul>

<p>Output <code>[fox, dog]</code></p>

<p>Is it possible to solve it using regex?</p>
