Regex CNPJ JavaScript

CPF
/^\d{3}\.\d{3}\.\d{3}\-\d{2}$/


CNPJ
/^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/

both
/(^\d{3}\.\d{3}\.\d{3}\-\d{2}$)|(^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$)/
Keven Silva