var str = '14-1';
var arr= str.match(/(\S*)-/);
console.log(arr);
// ["14-", "14", index: 0, input: "14-1", groups: undefined]
var arr1= str.match(/-(\S*)/);
console.log(arr1);
// ["-1", "1", index: 2, input: "14-1", groups: undefined]
var str = 'abc_123';
var s = str.substr(0, str.indexOf('_') + 1);
console.log(s); // abc_
var s1 = str.substr(str.indexOf('_') + 1);
console.log(s1); // 123