Advertisements
I had the following string ,
He is @(role)
I need to get the string which is present between @(
and )
.
Expected result ,
role
>Solution :
We can use match()
here:
var input = "He is @(role)";
var role = input.match(/@\((.*?)\)/)[1];
console.log(role);