Find word before opening parenthesis
<p>I have the following line of code:</p>

<pre><code>let regexp: RegExp = new RegExp('(?=\\s(.+))');
</code></pre>

<p>What I am trying to do is find the word that comes before a <code>(</code> in a code file.</p>

<p>With what I have, it matches more than what I would like.</p>

<pre><code>this is a test (
</code></pre>

<p>Matches : <code>is a test (</code> I just want <code>test</code></p>

<pre><code>for(
</code></pre>

<p>No matches were found.</p>

<p>So, how can I get the word that comes before the parenthesis?</p>