bes,
function calc(arr) {
var a = +arr[1],
b = +arr[3];
return {
'+': a + b,
'-': a - b,
'*': a * b,
'/': a / b
}
[arr[2]];
}
var mas = "example 5-15 =twenty, example 5+15 =twenty, example 15/5 =twenty, example 5*15 =twenty".split(",");
for (var i = 0; i < mas.length; i++) {
alert(calc(/.*?(\d+)(.)(\d+)/.exec(mas[i])));
}