JSFiddle - React, Tailwind, and code Playground
JavaScript
var a = 'F5';
var b = '5F';
var c = '555';
var d = '-5';
if (a.match(/^\d+$/) && parseInt(a) > 0)
console.log('a is valid');
if (b.match(/^\d+$/) && parseInt(b) > 0)
console.log('b is valid');
if (c.match(/^\d+$/) && parseInt(c) > 0)
console.log('c is valid');
if (d.match(/^\d+$/) && parseInt(d) > 0)
console.log('d is valid');