I want to write a regex which returns true if first n characters are numeric and only the last character is alphabet(single-capital-char.) and n could be any value.
What I have tried so far:
let str1 = "1222B";
console.log( /^[0-9][A-Z]$/.test(str1) ); // logs false but I'm expecting true.
For eg.
str1 = "1A"; -> true
str1 = "112111C"-> true
str1 = "11CC" -> false
str1 = "1c"-> false