Test, validate and match regular expressions
This regex matches positive and negative integers or floating-point numbers, designed primarily for extracting numerical coefficients from polynomial expressions. It intelligently avoids matching numbers that are part of larger words, fractions, or immediately preceding opening brackets, preventing false positives with functions or arrays.