Build, test, and debug regular expressions
This regex parses LaTeX `\newcommand` and `\renewcommand` declarations, extracting the macro name, optional number of arguments, and its definition into named capture groups. It is highly useful for static analysis, refactoring, or extracting custom macros from LaTeX documents.