JSFiddle - React, Tailwind, and code Playground

HTML

<input maxlength="18" />

JavaScript

$("input").on("keyup", function(e)
{
    $(this).val(
        $(this).val()
        .replace(/\D/g, '')
        .replace(/^(\d{2})(\d{3})?(\d{3})?(\d{4})?(\d{2})?/, "$1 $2 $3/$4-$5"));
});