How can I use RegExp to get value inside and outside the bracket
<p>I want to parse data-action in the string below. I've managed to get the data inside it, but I want to parse it so that "action" = togglestate and "params" = anything inside the brackets. I 'm not too good at regex but I'm currently using this with no avail: (This code is in the execaction function)</p>

<pre><code>var regex = /(.*)(\((.*)\))?/gi;
var list = elem.dataset.action.match(regex);
var action = list[1];
var params = list.splice(0,2).join();
</code></pre>

<p>HTML:</p>

<p><code>&lt;div data-action='toggleState(test)' onClick='execaction(this);' id='testelem'&gt;div running execaction on click with action parameter&lt;/div&gt;</code></p>
