I have successfully extracted the text inside the parentheses. While I am able to remove leading whitespace, I am facing difficulty in removing trailing whitespace.
Consider the text
node ( t-vr0wkjqky55s9mlh2rtt0u301(asdad) ) { }
Using my regex \(\s*(.*)\)
, I get
t-vr0wkjqky55s9mlh2rtt0u301(asdad) /
(noting the trailing whitespace; ignore /
).
You can view the code in action here.
Below is a live example demonstrating the issue:
var str = "node ( t-vr0wkjqky55s9mlh2rtt0u301(asdad) ) { }";
var rex = /\(\s*(.*)\)/;
console.log("[" + rex.exec(str)[1] + "]");