My intention is to refactor it so you can avoid regex if you want a simplier safer parser (since it could leave you vulnerable to attacks), where you could just look for simple string patterns instead.
However, I just needed something work for the time being and the current regex has been safe enough.