Not sure if this contains what you need, but it is worth a try.

Math.js[^]

An extensive math library for JavaScript and Node.js

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser and offers an integrated solution to work with numbers, big numbers, complex numbers, units, and matrices. Powerful and easy to use.

Features

Supports numbers, big numbers, fractions, complex numbers, units, strings, arrays, and matrices.

Is compatible with JavaScript's built-in Math library.

Contains a flexible expression parser.

Supports chained operations.

Comes with a large set of built-in functions and constants.

Has no dependencies. Runs on any JavaScript engine.

Is easily extensible.

Open source.

15,610,223 members

click here

The regex would be something like (.Net regex):

`^\s*([-+]?\s*(\d+|\w+))(\s*[-+*/]\s*([-+]?\s*(\d+|\w+)))*\s*$`

Cheers

Andi