Q:

How to make array with string list

I have a generated list which is like this 

196-1526, 85-651, 197-1519

I need the array like this. Each node has two part. I need only the first part of each node in one array.

196, 85, 197

I already have this code which generage 196
str.substr(0,str.indexOf('-'));

A:

You could use the following:
'196-1526, 85-651, 197-1519'.replace(/-\d+(,|$)/g, '').split(/\s/)

