I need a regular expression which accepts following format
1111A
or 1234B
.
I used /([0-9]{0,4})&([A-Z])/
but not able to get it.
I need a regular expression which accepts following format
1111A
or 1234B
.
I used /([0-9]{0,4})&([A-Z])/
but not able to get it.
Try using ^\d{4}[A-Z]$
const re = RegExp(/^\d{4}[A-Z]$/);
console.log(re.test('1111A'));
console.log(re.test('1A111'));
console.log(re.test('1111AA'));