function getTwoValue(exp) {
var matches = /^\d+\s*[\/*%+-]\s*(\d+)/.exec(exp);
return matches ? matches[1] : 0;
}
function sortByTwoValue(a, b) {
a = getTwoValue(a);
b = getTwoValue(b);
return a < b ? -1 : +(a > b);
}
var arr = [];
arr [0] = "1 + 2 =3"
arr [1] = "3* 2 =6"
arr [2] = "2+5 =7"
arr [3] = "1 +2=3"
arr.sort(sortByTwoValue);
console.log(arr);