RegExp.prototype.test returning mixed results
<p>I have a function which produces the following Regex for detecting Emojies which have been pasted into my applications text editor:</p>

<pre><code>var regex = /:[smile|laughing|blush|relaxed|smirk|heart_eyes|flushed|satisfied|grin|wink|stuck_out_tongue|sleeping|worried|fearful|frowning|confused|disappointed|cry|sob|rage|sunglasses|innocent|yum|facepalm|heart|broken_heart|exclamation|question|zzz|+1|thumbsdown|woman|man|kiss|clap|sunny|umbrella|snowman|gift|dollar|airplane|rocket|boat|steam_locomotive|four_leaf_clover|bell|bulb|computer|hammer|phone|microphone|fork_and_knife|pizza|wine_glass|beer|cocktail|checkered_flag|sos|no_entry|white_check_mark]+:/gi
</code></pre>

<p>Provided with the same regex and the same input <code>RegExp.prototype.test</code> produces varying results in the browser. </p>

<p><strong>Example</strong></p>

<pre><code>var regex = /:[smile|laughing|blush|relaxed|smirk|heart_eyes|flushed|satisfied|grin|wink|stuck_out_tongue|sleeping|worried|fearful|frowning|confused|disappointed|cry|sob|rage|sunglasses|innocent|yum|facepalm|heart|broken_heart|exclamation|question|zzz|+1|thumbsdown|woman|man|kiss|clap|sunny|umbrella|snowman|gift|dollar|airplane|rocket|boat|steam_locomotive|four_leaf_clover|bell|bulb|computer|hammer|phone|microphone|fork_and_knife|pizza|wine_glass|beer|cocktail|checkered_flag|sos|no_entry|white_check_mark]+:/gi
var match = ':ph:'
regex.test(match)
&gt;&gt;&gt;true
regex.test(match)
&gt;&gt;&gt;false
regex.test(match)
&gt;&gt;&gt;true
regex.test(match)
&gt;&gt;&gt;false
regex.test(match)
&gt;&gt;&gt;true
regex.test(match)
&gt;&gt;&gt;false
regex.test(match)
&gt;&gt;&gt;true
</code></pre>

<p><strong>Screen Shot</strong></p>

<p><a href="https://i.stack.imgur.com/yWJgf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yWJgf.png" alt="enter image description here"></a></p>

<p>I read the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test" rel="nofollow noreferrer">documentation</a> on this method and from everything I can tell this should be a pure function. Why is it returning different values provided with the same input?</p>