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
Post a Comment