var str = 'Привет - Пока'; var res = str.match(/(\S*)[\s]*-[\s]*(\S*)/); alert(res[1]); alert(res[2]);