>> I've always been wary of regexes.

Be afraid: https://owasp.org/www-community/attacks/Regular_expression_D...

https://en.wikipedia.org/wiki/ReDoS