JSFiddle - React, Tailwind, and code Playground

HTML

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

JavaScript

var hangul = new RegExp("[\u1100-\u11FF|\u3130-\u318F|\uA960-\uA97F|\uAC00-\uD7AF|\uD7B0-\uD7FF]");
var china = new RegExp("[\u4E00-\u9FFF|\u2FF0-\u2FFF|\u31C0-\u31EF|\u3200-\u9FBF|\uF900-\uFAFF]");

$("#lang").on("keypress keyup", function () {
    var that = $(this);
    var text = that.val();

    if (china.test(text)) {
        limit = 5;

    } else if (hangul.test(text)) {
        limit = 8;

    } else {
        limit = 11;
    }
    that.attr("maxlength", limit);
    if (text.length > limit) that.val(text.substring(0, limit))
});