regex - How to parse functions names from string using javascript? -


i'm looking reliable way function names string. string values can this:

let str = 'qwe(); asd();zxc()' //or let str = 'qwe("foo");asd(1);zxc();'  //etc. 

i want have array

['qwe', 'asd', 'zxc'] 

i tried str.split(';') how rid of parenthesis , can hold? there regexp match symbols on left of other symbol?

you can use simple regex find function names in .match()

var str = "qwe(); asd();zxc()";  console.log(str.match(/\w+(?=\()/g));


Comments

Popular posts from this blog

cookies - Yii2 Advanced - Share session between frontend and mainsite (duplicate of frontend for www) -

angular - password and confirm password field validation angular2 reactive forms -

php - Permission denied. Laravel linux server -