var src="http://site.ru/first-pic-320x220.jpg", arr = src.split(/\-(?=\d)/), d = arr[1].split("."); arr[0] += "."+d[1]; arr[1] = d[0]; alert(arr.join("\n"));