Check multiple strings for matching multiple regex (both array)
<p>I need to check all elements of an array (strings) if they matches any regex, which is also stored in an array.</p>

<p>So here is the string-array and and regex array (in this example all three elements are the same regex - I know that doesn't make sence):</p>

<pre><code>let array = [ 'just some', 'strings', 'which should be tested', 'by regex' ];
let regexes = [ /([^.]+)[.\s]*/g, /([^.]+)[.\s]*/g, /([^.]+)[.\s]*/g ];
</code></pre>

<p>Now I would do two <code>_.each</code>-loops like this:</p>

<pre><code>_.each(array, function(element) {
    _.each(regexes, function(regex) {
        let match = regex.exec(element);
        if (match &amp;&amp; match.length)
            doSomething(match);
    });
});
</code></pre>

<p>But what I want to achieve is, that if <strong>only one</strong> regex is matching, I want to process this string. So with this senseless regexes-array, this would never be the case, as there would be no or three matching regex.</p>

<p>Furthermore I would like to knwo if it possible to avoid this nested each-loop.</p>

<p><strong>Update</strong></p>

<p>Example:</p>

<pre><code>let array = [ '1. string', 'word', '123' ]
let regexes = [/([a-z]+)/, /([0-9]+)/]

array[0] should NOT pass the test, as both regex are matching
array[1] should pass the test, as just ONE regex is matching
array[2] should pass the test, as just ONE regex is matching
</code></pre>

<p>so only the result for array[1] and array[2] should be used for further processing <code>doSomething(match)</code></p>