JSFiddle - React, Tailwind, and code Playground

JavaScript

var regex1 = /^[A-z][A-z0-9_]+$/i;  //any alpha followed by any alpha or number or underscore
var regex2 = /^[A-Z][A-Z0-9_]+$/;  //any upper case alpha followed by any one or more upper case alpha or number or underscore

/* dummy some field inputs */
var tests = [
    'abcde',  //expect true, false (because not caps)
    '123',    //expect false, false (because no initial alpha)
    '1abe_',   //expect false, false (because no initial alpha and not all caps)
    'a123abc__', //expect true, false (because not all caps)
    'a43__a ', //expect false, false (because space at the end)
    'A12ABC_', //expect true, true 
    ' A12AB_', //expect false, false (because space at the beginning)
    ];

document.write('<table><tr><th>test</th><th>Regex 1</th><th>Regex2</th></tr>');
for(var i = 0; i<tests.length;i++){
    document.write('<tr><td>' + tests[i] + '</td>');
     if( regex1.test(tests[i]) ){
        document.write('<td>TRUE</td>');
    } else {
        document.write('<td>FALSE</td>');
    }
    if( regex2.test(tests[i]) ){
        document.write('<td>TRUE</td>');
    } else {
        document.write('<td>FALSE</td>');
    }
    document.write('</tr>');
}