JSFiddle - React, Tailwind, and code Playground
HTML
<span>www.mysite.com/users/</span>
<input id="short_url" type="text" />
CSS
.invalid{
background-color:red;
}
JavaScript
(function(){
var shortUrlRegexp = /^[a-zA-Z]{1}$/;
$("#short_url").on("keyup", function(){
var text = $(this).val();
var isMatch = shortUrlRegexp.test(text);
$(this).toggleClass("invalid", !isMatch);
});
}());