JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" name="c_Kenteken" maxlength="8" tabindex="3" id="invoerKenteken" class="zoek_kentekenplaat" onkeyup="FormatLicenseplate(this.value, GetSidecodeLicenseplate(this.value))" />

CSS

input.zoek_kentekenplaat {
    border:none;
    border-color:#F0F0F0;
    font-size: 18px;
    font-weight: bold;
    line-height: 0px;
    width: 125px;
    height: 30px;
    /*background-color: #f4be04;*/
    padding-left: 20px;
    /*border: 1px solid #ffcc00;*/
    padding-bottom: 0px;
    padding-top: 0px;
    text-transform: uppercase;
    margin-top: 2px;
    background: url(http://email.allianz.nl/public/ANG/278b2c33c92f75d6795b0c75e3a18e21/kenteken_125_2_2.jpg) no-repeat;
}

JavaScript

function GetSidecodeLicenseplate(Licenseplate) {
    alert(Licenseplate)
    var arrSC = [];
    var scUitz = '';

    Licenseplate = Licenseplate.replace('-', '').toUpperCase();

    arrSC[0] = /^[a-zA-Z]{2}[\d]{2}[\d]{2}$/; //   1       XX-99-99
    arrSC[1] = /^[\d]{2}[\d]{2}[a-zA-Z]{2}$/; //   2       99-99-XX
    arrSC[2] = /^[\d]{2}[a-zA-Z]{2}[\d]{2}$/; //   3       99-XX-99
    arrSC[3] = /^[a-zA-Z]{2}[\d]{2}[a-zA-Z]{2}$/; //   4       XX-99-XX
    arrSC[4] = /^[a-zA-Z]{2}[a-zA-Z]{2}[\d]{2}$/; //   5       XX-XX-99
    arrSC[5] = /^[\d]{2}[a-zA-Z]{2}[a-zA-Z]{2}$/; //   6       99-XX-XX
    arrSC[6] = /^[\d]{2}[a-zA-Z]{3}[\d]{1}$/; //   7       99-XXX-9
    arrSC[7] = /^[\d]{1}[a-zA-Z]{3}[\d]{2}$/; //   8       9-XXX-99
    arrSC[8] = /^[a-zA-Z]{2}[\d]{3}[a-zA-Z]{1}$/; //   9       XX-999-X
    arrSC[9] = /^[a-zA-Z]{1}[\d]{3}[a-zA-Z]{2}$/; //   10      X-999-XX

    //except licenseplates for diplomats
    scUitz = '^CD[ABFJNST][0-9]{1,3}$'; //for example: CDB1 of CDJ45

    for (i = 0; i < arrSC.length; i++) {
        if (Licenseplate.match(arrSC[i])) {
            return i + 1;
        }
    }
    if (Licenseplate.match(scUitz)) {
        return 'CD';
    }
    return false;
}

function FormatLicenseplate(Licenseplate, Sidecode) {
    alert(Licenseplate + " " + Sidecode);
    Licenseplate = Licenseplate.replace('-', '').toUpperCase();

    if (Sidecode <= 6) {
        return Licenseplate.substr(0, 2) + '-' + Licenseplate.substr(2, 2) + '-' + Licenseplate.substr(4, 2);
    }
    if (Sidecode == 7 || Sidecode == 9) {
        return Licenseplate.substr(0, 2) + '-' + Licenseplate.substr(2, 3) + '-' + Licenseplate.substr(5, 1);
    }
    if (Sidecode == 8 || Sidecode == 10) {
        return Licenseplate.substr(0, 1) + '-' + Licenseplate.substr(1, 3) + '-' + Licenseplate.substr(4, 2);
    }
    return Licenseplate;
}