edit: I should really say that you should consider using regular languages to lex your programming languages, not (Perl-style) regexes. Those are different things:
https://swtch.com/~rsc/regexp/
I used re2c for Oil and it saves around 5K-10K lines of "groveling through backslashes and braces one a time" (e.g. what other shells do)
http://www.oilshell.org/blog/2019/12/22.html#appendix-a-oils...
And the parser is faster than bash overall: