Test, validate and match regular expressions
This regex tokenizes arithmetic expressions by matching numbers (integer or decimal with dot/comma), single-letter variables, operators (+, -, *, /, ^), parentheses, whitespace, and any unexpected character as an error. Each token type is captured in a named group, making it ideal for lexical analysis in a calculator or expression evaluator. The g and m flags enable scanning across multiple lines and repeated matches.