I\'m trying to parse the following kind of string:
[key:\"val\" key2:\"val2\"]
where there are arbitrary key:\"val\" pairs inside. I want t
str.match(pattern), if pattern has the global flag g, will return all the matches as an array.
str.match(pattern)
pattern
g
For example:
const str = 'All of us except @Emran, @Raju and @Noman was there'; console.log( str.match(/@\w*/g) ); // Will log ["@Emran", "@Raju", "@Noman"]