Regex from loops
<pre><code>this.personRegex = (input) =&gt; {
            return new RegExp(persons.map((person) =&gt; {
                return person.fullname;
            }).join("|"), "gi");
        }
</code></pre>

<p>the above give me :</p>

<pre><code>/lwe|alvin/gi;
</code></pre>

<p>How do I get the below:</p>

<pre><code>/\b(?:lwe|alvin)\b/gi;
</code></pre>