JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="regex" />

JavaScript

$("#regex").on("change", function()
               {
                   var result = "error";
                   
                   if ($(this).val().match(/^\d{1,2}:[A-Za-z0-9_-]{7,14}$/))
                   {
                       result = "ok";
                   }
                   
                   alert(result);
               });