Here's a regex that can do what I think you're looking for:
/(?:(?:^|[-+_*/])(?:\s*-?\d+(\.\d+)?(?:[eE][+-]?\d+)?\s*))+$/
https://regex101.com/r/w74GSk/4
It matches a number, optionally negative, with an optional decimal number followed by zero or more operator/number pairs.
It also allows for whitespace between numbers and operators.
const re = /(?:(?:^|[-+_*/])(?:\s*-?\d+(\.\d+)?(?:[eE][+-]?\d+)?\s*))+$/;
function test(s) {
console.log("%s is valid? %s", s, re.test(s));
}
// valid
test(" 1 ");
test("1 + 2");
test(" 1 * 2 * 3 ");
test("-1 * 2 - -3");
test("-1 * 2 - -3e4");
test("-1 * 2 - -3.5E6");
// invalid
test("1 +");
test("1 + foo");
This may need to be expanded, based on what you want to allow. One thing it does not handle is parentheses to override operator precedence.